Arc Forumnew | comments | leaders | submitlogin
3 points by absz 5670 days ago | link | parent

There is http://arclanguage.org/item?id=1629 (http://halogen.note.amherst.edu/~jdtang/arclite/), which is similar to what you mention; however, it's old now.


5 points by andreyf 5670 days ago | link

Cool, but I was thinking more something which would simply translate

    (foo "bar" 1 2)
into

    foo("bar", 1, 2)
One motivation is that just about all of JS can be written in Arc, but would also gain the advantage of macros.

-----

3 points by nostrademons 5654 days ago | link

There was some reason I didn't do it that way (I'm the author of ArcLite). IIRC, it was because the semantics of Arc forms differed in a way that would basically require an Arc interpreter anyway, even if you compiled them. For example,

    (foo "bar" 1 2)
is only a function call if foo is a function object. If foo is an array, it's an array index; if it's a hash, it's a dictionary get (both ill-formed in this example). Other operations are similarly polymorphic, eg. overloading + for addition and concatenation. In order to translate that reliably to JavaScript, you'd need to turn every funcall form into a type-dispatch. At that point, you're basically writing an interpreter anyway.

-----