something other than C

49 views
Skip to first unread message

Raoul Duke

unread,
May 3, 2016, 4:22:32 PM5/3/16
to ats-lang-users
hi,

Whenever I try to get a project building via C/++ I find it kind of a nightmare. Usually things don't work for me out of the box for whatever reasons. I tend to have more luck with e.g. Java.

I wonder if it would be possible to have a version/target of ATS that did not depend on C, even if it ends up writing out C. There are translators from C to Java, for example.

I know, I know, it is probably a terrible fool's errand to even think about this...

Brandon Barker

unread,
May 3, 2016, 4:55:27 PM5/3/16
to ats-lang-users
Do I recall correctly that ATS is running in the browser now? So
Javascript, not Java. Maybe package it up as node module... (I know
next to nothing about node).
> --
> 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 https://groups.google.com/group/ats-lang-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ats-lang-users/CAJ7XQb46qtNkC%3DruvjTsWgtYGFU%3D6SP%3DdFgpijdrfu%3DWN9Nw2w%40mail.gmail.com.



--
Brandon Barker
brandon...@gmail.com

Raoul Duke

unread,
May 3, 2016, 4:56:31 PM5/3/16
to ats-lang-users
(i think only via emscripten, a route i personally do not like, but ymmv.)

Hongwei Xi

unread,
May 3, 2016, 5:42:53 PM5/3/16
to ats-lan...@googlegroups.com
Well, I am actually thinking about targeting Java.

It is just that there is too much other stuff at my hand right now...

By the way, the atscc2js compiler (for compiling the C code generated from ATS into Javascript)
is getting more and more mature. I am using it all the time to do what I call ATS and JS co-programming.
For instance, this is a poor man's worm game I just wrote in ATS for my class:

http://www.cs.bu.edu/~hwxi/academic/courses/CS320/Spring16/assignments/10/Wormlike/Wormlike.html

Will find some time to use JS for the graphics part later.

By the way, I use Bacon.js for control, which is a FRP-based JS library. I have an interface for it in ATS. Really love it!


On Tue, May 3, 2016 at 4:56 PM, Raoul Duke <rao...@gmail.com> wrote:
(i think only via emscripten, a route i personally do not like, but ymmv.)

--
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 https://groups.google.com/group/ats-lang-users.

gmhwxi

unread,
May 3, 2016, 6:07:55 PM5/3/16
to ats-lang-users

Speaking of emscripten, I have a few horror stories of my own.

But I have to say that it is quite an impressive project. I once said
that it was a small miracle that the entire ATS compiler (atsopt) can
actually be compiled into JS successfully via emscripten. The generated
C code alone consists of at least 500K lines. In general, emscripten is
not well-suited for handling C code generated from ATS that makes use
of higher-order functions. I almost gave up. At the end, templates saved
the day: I replaced various higher-order functions in atsopt with templates
to allow them to be properly eliminated (through inlining). This kind of replacement
had been designed to support the use of higher-order functions in embedded programming,
but it was used in this very peculiar setting to solve a very peculiar problem :)

Cheers!

Brandon Barker

unread,
May 3, 2016, 9:33:37 PM5/3/16
to ats-lang-users
I at least would probably use ATS/Java co-programming for something
eventually -- somewhat surprisingly (though not in retrospect) I have
yet to take on even one C/C++ project in the last 1.5 years but have
had three inherited and one new JVM project (which have mostly used
Java and Scala) ...
> https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLosBiqRBjetA80A5BYWwqjCcT0fN4hynaMXMSAyHfd%2BeA%40mail.gmail.com.



--
Brandon Barker
brandon...@gmail.com

Artyom Shalkhakov

unread,
May 4, 2016, 12:09:46 PM5/4/16
to ats-lang-users
On Wednesday, May 4, 2016 at 7:33:37 AM UTC+6, Brandon Barker wrote:
I at least would probably use ATS/Java co-programming for something
eventually -- somewhat surprisingly (though not in retrospect) I have
yet to take on even one C/C++ project in the last 1.5 years but have
had three inherited and one new JVM project (which have mostly used
Java and Scala) ...



I think that ATSCC->C# could be a good idea for a project too. I initially tried to go the ATSCC->CIL route because I was very concerned about subverting static typing in the target language. I now think it was a mistake. A source-to-source compiler would make things much easier.

Raoul Duke

unread,
May 4, 2016, 12:39:58 PM5/4/16
to ats-lang-users
Source to source does seem safest in terms of FFI with that other language. There are probably bytecodes / sequences thereof that would not be interoperable with regular Java/C# sources in some weird way that is not fun to debug.
Reply all
Reply to author
Forward
0 new messages