Arc Forumnew | comments | leaders | submitlogin
5 points by andreyf 5866 days ago | link | parent

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 5850 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.

-----