ATS+Emscripten

Emscripten is a compiler for translating LLVM in to JavaScript.
I added a few examples in the following directory showing how ATS and
Emscripten can be used together:

There are now two ways of generating JS from ATS source:

  1. ATS -> C -(via Atscc2js)-> JS
  2. ATS -> C -(via Emscripten)-> JS

JS code generated from 1) and 2) can actually be combined for use. The
fact2 example
in the above directory is such a case.

I would use both. Compared to Emscripten, Atscc2js make it so much easier
for ATS to interact with JS. I often use Atscc2js to do what I call ATS and
JS
co-programming. For writing performant JS code, going the Emscripten route
should
likely be a sensible option.

To use GC in the JS code generated by Emscripten, one needs to compile a
garbage
collector (like libgc) to JS via Emscripten. I have not tried it yet. Of
course, using
linear types to avoid GC is another option, especially, for performant code.On Wed, Oct 21, 2015 at 1:24 AM, H Zhang zht...@gmail.com wrote:

Which one do you expect people to use in the long term? I thought ATS
translated C is rather close to assembly and JS engines have optimizing JIT
compiling. It is interesting to note that Google’s Dart VM does not use
byte code as they claim it is better to JIT from source.

One thing I’ve read is that asm.js does not currently support GC. So does
Emscipten compiled ATS support GC or no?

Haitao

On Monday, October 19, 2015 at 6:01:57 AM UTC-7, gmhwxi wrote:

Emscripten is a compiler for translating LLVM in to JavaScript.
I added a few examples in the following directory showing how ATS and
Emscripten can be used together:

https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/JS-emscripten

There are now two ways of generating JS from ATS source:

  1. ATS → C -(via Atscc2js)-> JS
  2. ATS → C -(via Emscripten)-> JS

JS code generated from 1) and 2) can actually be combined for use. The
fact2 example
in the above directory is such a case.


You received this message because you are subscribed to the Google Groups
“ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/47bcb600-9bf4-4798-97b2-cb7764b86e54%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/47bcb600-9bf4-4798-97b2-cb7764b86e54%40googlegroups.com?utm_medium=email&utm_source=footer
.

I have not used emscripten either but as I understand it the idea is that
asm.js emulates the virtual memory with a large array. When you compile
with emscripten pointers become indices into the array. The supporting
browsers have the choice of translating the restricted js of asm.js back
into native code and run the native code directly and just trap foreign (in
this case javascript) calls like a hypervisor would (essentially you have
an embedded hypervisor in your browser). However whether ahead of time
compilation is supported or not, as far as js is concerned the whole thing
is a big blob so it can’t GC any objects embedded in the array as it has no
idea of how structures are embedded in the array (managed by indices
translated from pointers). If your code is from a manually managed C/C++
code you are okay. But if your code is allocation happy like ML you will
run out of memory eventually.On Wednesday, October 21, 2015 at 3:25:56 PM UTC-7, Brandon Barker wrote:

I’ve never used emscripten, so I don’t quite understand why you would need
a GC for it. Won’t the browser’s javascript engine use GC regardless of how
the javascript was generated (admittedly perhaps unpredictably, as always)?

On Wed, Oct 21, 2015 at 6:01 PM, gmhwxi <gmh...@gmail.com <javascript:>> wrote:

The GC issue actually came up today.

When I ran patsopt in the browser, it worked the first time
(to generate C code correctly) but it did not work the second
time. I guess that this was due to excessive use of memory.

To circumvent the issue, I had to reload the JS script for patsopt
after using it once :frowning:

On Wednesday, October 21, 2015 at 7:54:53 AM UTC-4, gmhwxi wrote:

I would use both. Compared to Emscripten, Atscc2js make it so much easier
for ATS to interact with JS. I often use Atscc2js to do what I call ATS
and JS
co-programming. For writing performant JS code, going the Emscripten
route should
likely be a sensible option.

To use GC in the JS code generated by Emscripten, one needs to compile a
garbage
collector (like libgc) to JS via Emscripten. I have not tried it yet. Of
course, using
linear types to avoid GC is another option, especially, for performant
code.

On Wed, Oct 21, 2015 at 1:24 AM, H Zhang zh...@gmail.com wrote:

Which one do you expect people to use in the long term? I thought ATS
translated C is rather close to assembly and JS engines have optimizing JIT
compiling. It is interesting to note that Google’s Dart VM does not use
byte code as they claim it is better to JIT from source.

One thing I’ve read is that asm.js does not currently support GC. So
does Emscipten compiled ATS support GC or no?

Haitao

On Monday, October 19, 2015 at 6:01:57 AM UTC-7, gmhwxi wrote:

Emscripten is a compiler for translating LLVM in to JavaScript.
I added a few examples in the following directory showing how ATS and
Emscripten can be used together:

https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/JS-emscripten

There are now two ways of generating JS from ATS source:

  1. ATS → C -(via Atscc2js)-> JS
  2. ATS → C -(via Emscripten)-> JS

JS code generated from 1) and 2) can actually be combined for use. The
fact2 example
in the above directory is such a case.


You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com <javascript:>.
To post to this group, send email to ats-l...@googlegroups.com
<javascript:>.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/47bcb600-9bf4-4798-97b2-cb7764b86e54%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/47bcb600-9bf4-4798-97b2-cb7764b86e54%40googlegroups.com?utm_medium=email&utm_source=footer
.


You received this message because you are subscribed to the Google Groups
“ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to ats-lang...@googlegroups.com <javascript:>.
To post to this group, send email to ats-l...@googlegroups.com
<javascript:>.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/594efae0-a344-4f3f-9065-2a98908bde2a%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/594efae0-a344-4f3f-9065-2a98908bde2a%40googlegroups.com?utm_medium=email&utm_source=footer
.


Brandon Barker
brand...@gmail.com <javascript:>

I see. The C instruction set

is a bit incongruent with js semantics. I was actually surprised that the
js code was generated from the c code. Is it possible to tweak the
instructions and generate js code directly? The underlying concepts should
be translatable? For heap allocations one can translate ATS_MALLOC into a
returning a js array; pointer arithmetic into index arithmetic; and free
into null assignment. On stack arrays can be treated similarly. Other
pointer semantics need to be replaced with value semantics of js objects.

HaitaoOn Wednesday, October 21, 2015 at 6:53:42 PM UTC-7, gmhwxi wrote:

Atscc2js can only compile an ML-like subset of ATS. In particular,
it does not handle pointers, which are abundantly used in patsopt.

On Wednesday, October 21, 2015 at 6:29:27 PM UTC-4, H Zhang wrote:

Is atscc2js compiled js not fast enough? Since GC pause is not an issue
here and I remember ats compilers are quite fast, I would hope the js
version should just work.

On Wednesday, October 21, 2015 at 3:01:55 PM UTC-7, gmhwxi wrote:

The GC issue actually came up today.

When I ran patsopt in the browser, it worked the first time
(to generate C code correctly) but it did not work the second
time. I guess that this was due to excessive use of memory.

To circumvent the issue, I had to reload the JS script for patsopt
after using it once :frowning:

On Wednesday, October 21, 2015 at 7:54:53 AM UTC-4, gmhwxi wrote:

I would use both. Compared to Emscripten, Atscc2js make it so much
easier
for ATS to interact with JS. I often use Atscc2js to do what I call ATS
and JS
co-programming. For writing performant JS code, going the Emscripten
route should
likely be a sensible option.

To use GC in the JS code generated by Emscripten, one needs to compile
a garbage
collector (like libgc) to JS via Emscripten. I have not tried it yet.
Of course, using
linear types to avoid GC is another option, especially, for performant
code.

On Wed, Oct 21, 2015 at 1:24 AM, H Zhang zh...@gmail.com wrote:

Which one do you expect people to use in the long term? I thought ATS
translated C is rather close to assembly and JS engines have optimizing JIT
compiling. It is interesting to note that Google’s Dart VM does not use
byte code as they claim it is better to JIT from source.

One thing I’ve read is that asm.js does not currently support GC. So
does Emscipten compiled ATS support GC or no?

Haitao

On Monday, October 19, 2015 at 6:01:57 AM UTC-7, gmhwxi wrote:

Emscripten is a compiler for translating LLVM in to JavaScript.
I added a few examples in the following directory showing how ATS and
Emscripten can be used together:

https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/JS-emscripten

There are now two ways of generating JS from ATS source:

  1. ATS → C -(via Atscc2js)-> JS
  2. ATS → C -(via Emscripten)-> JS

JS code generated from 1) and 2) can actually be combined for use.
The fact2 example
in the above directory is such a case.


You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/47bcb600-9bf4-4798-97b2-cb7764b86e54%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/47bcb600-9bf4-4798-97b2-cb7764b86e54%40googlegroups.com?utm_medium=email&utm_source=footer
.

I’ve never used emscripten, so I don’t quite understand why you would need
a GC for it. Won’t the browser’s javascript engine use GC regardless of how
the javascript was generated (admittedly perhaps unpredictably, as always)?On Wed, Oct 21, 2015 at 6:01 PM, gmhwxi gmh...@gmail.com wrote:

The GC issue actually came up today.

When I ran patsopt in the browser, it worked the first time
(to generate C code correctly) but it did not work the second
time. I guess that this was due to excessive use of memory.

To circumvent the issue, I had to reload the JS script for patsopt
after using it once :frowning:

On Wednesday, October 21, 2015 at 7:54:53 AM UTC-4, gmhwxi wrote:

I would use both. Compared to Emscripten, Atscc2js make it so much easier
for ATS to interact with JS. I often use Atscc2js to do what I call ATS
and JS
co-programming. For writing performant JS code, going the Emscripten
route should
likely be a sensible option.

To use GC in the JS code generated by Emscripten, one needs to compile a
garbage
collector (like libgc) to JS via Emscripten. I have not tried it yet. Of
course, using
linear types to avoid GC is another option, especially, for performant
code.

On Wed, Oct 21, 2015 at 1:24 AM, H Zhang zh...@gmail.com wrote:

Which one do you expect people to use in the long term? I thought ATS
translated C is rather close to assembly and JS engines have optimizing JIT
compiling. It is interesting to note that Google’s Dart VM does not use
byte code as they claim it is better to JIT from source.

One thing I’ve read is that asm.js does not currently support GC. So
does Emscipten compiled ATS support GC or no?

Haitao

On Monday, October 19, 2015 at 6:01:57 AM UTC-7, gmhwxi wrote:

Emscripten is a compiler for translating LLVM in to JavaScript.
I added a few examples in the following directory showing how ATS and
Emscripten can be used together:

https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/JS-emscripten

There are now two ways of generating JS from ATS source:

  1. ATS → C -(via Atscc2js)-> JS
  2. ATS → C -(via Emscripten)-> JS

JS code generated from 1) and 2) can actually be combined for use. The
fact2 example
in the above directory is such a case.


You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/47bcb600-9bf4-4798-97b2-cb7764b86e54%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/47bcb600-9bf4-4798-97b2-cb7764b86e54%40googlegroups.com?utm_medium=email&utm_source=footer
.


You received this message because you are subscribed to the Google Groups
“ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/594efae0-a344-4f3f-9065-2a98908bde2a%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/594efae0-a344-4f3f-9065-2a98908bde2a%40googlegroups.com?utm_medium=email&utm_source=footer
.

Brandon Barker
brandon...@gmail.com

Is atscc2js compiled js not fast enough? Since GC pause is not an issue
here and I remember ats compilers are quite fast, I would hope the js
version should just work.On Wednesday, October 21, 2015 at 3:01:55 PM UTC-7, gmhwxi wrote:

The GC issue actually came up today.

When I ran patsopt in the browser, it worked the first time
(to generate C code correctly) but it did not work the second
time. I guess that this was due to excessive use of memory.

To circumvent the issue, I had to reload the JS script for patsopt
after using it once :frowning:

On Wednesday, October 21, 2015 at 7:54:53 AM UTC-4, gmhwxi wrote:

I would use both. Compared to Emscripten, Atscc2js make it so much easier
for ATS to interact with JS. I often use Atscc2js to do what I call ATS
and JS
co-programming. For writing performant JS code, going the Emscripten
route should
likely be a sensible option.

To use GC in the JS code generated by Emscripten, one needs to compile a
garbage
collector (like libgc) to JS via Emscripten. I have not tried it yet. Of
course, using
linear types to avoid GC is another option, especially, for performant
code.

On Wed, Oct 21, 2015 at 1:24 AM, H Zhang zh...@gmail.com wrote:

Which one do you expect people to use in the long term? I thought ATS
translated C is rather close to assembly and JS engines have optimizing JIT
compiling. It is interesting to note that Google’s Dart VM does not use
byte code as they claim it is better to JIT from source.

One thing I’ve read is that asm.js does not currently support GC. So
does Emscipten compiled ATS support GC or no?

Haitao

On Monday, October 19, 2015 at 6:01:57 AM UTC-7, gmhwxi wrote:

Emscripten is a compiler for translating LLVM in to JavaScript.
I added a few examples in the following directory showing how ATS and
Emscripten can be used together:

https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/JS-emscripten

There are now two ways of generating JS from ATS source:

  1. ATS → C -(via Atscc2js)-> JS
  2. ATS → C -(via Emscripten)-> JS

JS code generated from 1) and 2) can actually be combined for use. The
fact2 example
in the above directory is such a case.


You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com <javascript:>.
To post to this group, send email to ats-l...@googlegroups.com
<javascript:>.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/47bcb600-9bf4-4798-97b2-cb7764b86e54%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/47bcb600-9bf4-4798-97b2-cb7764b86e54%40googlegroups.com?utm_medium=email&utm_source=footer
.

Which one do you expect people to use in the long term? I thought ATS
translated C is rather close to assembly and JS engines have optimizing JIT
compiling. It is interesting to note that Google’s Dart VM does not use
byte code as they claim it is better to JIT from source.

One thing I’ve read is that asm.js does not currently support GC. So does
Emscipten compiled ATS support GC or no?

HaitaoOn Monday, October 19, 2015 at 6:01:57 AM UTC-7, gmhwxi wrote:

Emscripten is a compiler for translating LLVM in to JavaScript.
I added a few examples in the following directory showing how ATS and
Emscripten can be used together:

https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/JS-emscripten

There are now two ways of generating JS from ATS source:

  1. ATS → C -(via Atscc2js)-> JS
  2. ATS → C -(via Emscripten)-> JS

JS code generated from 1) and 2) can actually be combined for use. The
fact2 example
in the above directory is such a case.

Also, various libc functions (e.g., fopen) needs to be replaced, which
requires a lot of work.On Wednesday, October 21, 2015 at 10:45:01 PM UTC-4, H Zhang wrote:

I see. The C instruction set
https://github.com/githwxi/ATS-Postiats/blob/master/ccomp/runtime/pats_ccomp_instrset.h
is a bit incongruent with js semantics. I was actually surprised that the
js code was generated from the c code. Is it possible to tweak the
instructions and generate js code directly? The underlying concepts should
be translatable? For heap allocations one can translate ATS_MALLOC into a
returning a js array; pointer arithmetic into index arithmetic; and free
into null assignment. On stack arrays can be treated similarly. Other
pointer semantics need to be replaced with value semantics of js objects.

Haitao

On Wednesday, October 21, 2015 at 6:53:42 PM UTC-7, gmhwxi wrote:

Atscc2js can only compile an ML-like subset of ATS. In particular,
it does not handle pointers, which are abundantly used in patsopt.

On Wednesday, October 21, 2015 at 6:29:27 PM UTC-4, H Zhang wrote:

Is atscc2js compiled js not fast enough? Since GC pause is not an issue
here and I remember ats compilers are quite fast, I would hope the js
version should just work.

On Wednesday, October 21, 2015 at 3:01:55 PM UTC-7, gmhwxi wrote:

The GC issue actually came up today.

When I ran patsopt in the browser, it worked the first time
(to generate C code correctly) but it did not work the second
time. I guess that this was due to excessive use of memory.

To circumvent the issue, I had to reload the JS script for patsopt
after using it once :frowning:

On Wednesday, October 21, 2015 at 7:54:53 AM UTC-4, gmhwxi wrote:

I would use both. Compared to Emscripten, Atscc2js make it so much
easier
for ATS to interact with JS. I often use Atscc2js to do what I call
ATS and JS
co-programming. For writing performant JS code, going the Emscripten
route should
likely be a sensible option.

To use GC in the JS code generated by Emscripten, one needs to compile
a garbage
collector (like libgc) to JS via Emscripten. I have not tried it yet.
Of course, using
linear types to avoid GC is another option, especially, for performant
code.

On Wed, Oct 21, 2015 at 1:24 AM, H Zhang zh...@gmail.com wrote:

Which one do you expect people to use in the long term? I thought ATS
translated C is rather close to assembly and JS engines have optimizing JIT
compiling. It is interesting to note that Google’s Dart VM does not use
byte code as they claim it is better to JIT from source.

One thing I’ve read is that asm.js does not currently support GC. So
does Emscipten compiled ATS support GC or no?

Haitao

On Monday, October 19, 2015 at 6:01:57 AM UTC-7, gmhwxi wrote:

Emscripten is a compiler for translating LLVM in to JavaScript.
I added a few examples in the following directory showing how ATS and
Emscripten can be used together:

https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/JS-emscripten

There are now two ways of generating JS from ATS source:

  1. ATS → C -(via Atscc2js)-> JS
  2. ATS → C -(via Emscripten)-> JS

JS code generated from 1) and 2) can actually be combined for use.
The fact2 example
in the above directory is such a case.


You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/47bcb600-9bf4-4798-97b2-cb7764b86e54%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/47bcb600-9bf4-4798-97b2-cb7764b86e54%40googlegroups.com?utm_medium=email&utm_source=footer
.

Atscc2js can only compile an ML-like subset of ATS. In particular,
it does not handle pointers, which are abundantly used in patsopt.On Wednesday, October 21, 2015 at 6:29:27 PM UTC-4, H Zhang wrote:

Is atscc2js compiled js not fast enough? Since GC pause is not an issue
here and I remember ats compilers are quite fast, I would hope the js
version should just work.

On Wednesday, October 21, 2015 at 3:01:55 PM UTC-7, gmhwxi wrote:

The GC issue actually came up today.

When I ran patsopt in the browser, it worked the first time
(to generate C code correctly) but it did not work the second
time. I guess that this was due to excessive use of memory.

To circumvent the issue, I had to reload the JS script for patsopt
after using it once :frowning:

On Wednesday, October 21, 2015 at 7:54:53 AM UTC-4, gmhwxi wrote:

I would use both. Compared to Emscripten, Atscc2js make it so much easier
for ATS to interact with JS. I often use Atscc2js to do what I call ATS
and JS
co-programming. For writing performant JS code, going the Emscripten
route should
likely be a sensible option.

To use GC in the JS code generated by Emscripten, one needs to compile a
garbage
collector (like libgc) to JS via Emscripten. I have not tried it yet. Of
course, using
linear types to avoid GC is another option, especially, for performant
code.

On Wed, Oct 21, 2015 at 1:24 AM, H Zhang zh...@gmail.com wrote:

Which one do you expect people to use in the long term? I thought ATS
translated C is rather close to assembly and JS engines have optimizing JIT
compiling. It is interesting to note that Google’s Dart VM does not use
byte code as they claim it is better to JIT from source.

One thing I’ve read is that asm.js does not currently support GC. So
does Emscipten compiled ATS support GC or no?

Haitao

On Monday, October 19, 2015 at 6:01:57 AM UTC-7, gmhwxi wrote:

Emscripten is a compiler for translating LLVM in to JavaScript.
I added a few examples in the following directory showing how ATS and
Emscripten can be used together:

https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/JS-emscripten

There are now two ways of generating JS from ATS source:

  1. ATS → C -(via Atscc2js)-> JS
  2. ATS → C -(via Emscripten)-> JS

JS code generated from 1) and 2) can actually be combined for use. The
fact2 example
in the above directory is such a case.


You received this message because you are subscribed to the Google
Groups “ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ats-lang...@googlegroups.com.
To post to this group, send email to ats-l...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/47bcb600-9bf4-4798-97b2-cb7764b86e54%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/47bcb600-9bf4-4798-97b2-cb7764b86e54%40googlegroups.com?utm_medium=email&utm_source=footer
.

The GC issue actually came up today.

When I ran patsopt in the browser, it worked the first time
(to generate C code correctly) but it did not work the second
time. I guess that this was due to excessive use of memory.

To circumvent the issue, I had to reload the JS script for patsopt
after using it once :(On Wednesday, October 21, 2015 at 7:54:53 AM UTC-4, gmhwxi wrote:

I would use both. Compared to Emscripten, Atscc2js make it so much easier
for ATS to interact with JS. I often use Atscc2js to do what I call ATS
and JS
co-programming. For writing performant JS code, going the Emscripten route
should
likely be a sensible option.

To use GC in the JS code generated by Emscripten, one needs to compile a
garbage
collector (like libgc) to JS via Emscripten. I have not tried it yet. Of
course, using
linear types to avoid GC is another option, especially, for performant
code.

On Wed, Oct 21, 2015 at 1:24 AM, H Zhang zh...@gmail.com wrote:

Which one do you expect people to use in the long term? I thought ATS
translated C is rather close to assembly and JS engines have optimizing JIT
compiling. It is interesting to note that Google’s Dart VM does not use
byte code as they claim it is better to JIT from source.

One thing I’ve read is that asm.js does not currently support GC. So does
Emscipten compiled ATS support GC or no?

Haitao

On Monday, October 19, 2015 at 6:01:57 AM UTC-7, gmhwxi wrote:

Emscripten is a compiler for translating LLVM in to JavaScript.
I added a few examples in the following directory showing how ATS and
Emscripten can be used together:

https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/JS-emscripten

There are now two ways of generating JS from ATS source:

  1. ATS → C -(via Atscc2js)-> JS
  2. ATS → C -(via Emscripten)-> JS

JS code generated from 1) and 2) can actually be combined for use. The
fact2 example
in the above directory is such a case.


You received this message because you are subscribed to the Google Groups
“ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/47bcb600-9bf4-4798-97b2-cb7764b86e54%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/47bcb600-9bf4-4798-97b2-cb7764b86e54%40googlegroups.com?utm_medium=email&utm_source=footer
.