Arc Forumnew | comments | leaders | submitlogin
3 points by sacado 6077 days ago | link | parent

Yep. For the moment, I'm treating them as builtins. They will have to be implemented the way you mention it, that's for sure. I guess the easiest way would be to declare them both ways : as primitives (i.e., + translated to %+ when it is met) and as built-in functions, the way ccc is defined.


3 points by almkglor 6077 days ago | link

Hmm, that's true, you do need to handle stuff like:

  (map + (list 1 2 3) (list 9 8 7))
Haruu, compiling dynamic languages is hard... ^^

For that matter, it shouldn't be so difficult - basically if the compiler ever sees (set + ...) anywhere (where + is a global, at least), it disables the use of %+.

Possibly, we could add another step in the transformation process (which is why I suggested the structure in http://arclanguage.com/item?id=5598 to allow easy insertion/deletion of steps).

Basically the new step just traverses the structure (without mutating it) and creates a list of built-ins to disable.

Edit: or better - it traverses the structure and replaces + with %+, until it reaches a top-level node which has (set + ...), so that code which doesn't use the redefined + will still refer to the builtin %+.

-----