Closed Kesanov closed 7 years ago
Woops! I'll take a look soon.
Edit: OK, so, that's a clear type error, because <(add 1)
is syntax sugar to add 1 x => x
. Moon has unspecified behavior when there is a type error such as looking up a key not present in a map, or calling numbers on things. moon run "(add 1 x => x)"
returns JavaScript too.
Changing that would need some runtime checks which could destroy the performance of the fast evaluator, for example, so I decided to just declare those things as unspecified behavior - you should in theory have checked your code before compiling it to Moon. Makes sense?
Oh I see. Would it be possible to have a command that evaluates a term to normal form ( add 1 a => a
in this case), before trying to interpret it?