Arc Forumnew | comments | leaders | submitlogin
3 points by rocketnia 896 days ago | link | parent

(Psst, to get italics, use asterisks, not underscores. http://arclanguage.org/formatdoc)

Option 2 looks particularly troublesome to me. A veteran lisp user seeing "save-middle-earth ()" will probably guess it means "(save-middle-earth ())", with () being the empty list. Do you have () in bullet?

It might be less confusing to use dot syntax instead, like this...

  save-middle-earth.
...because that looks a bit like "foo.bar" syntax with no argument. Alternatitvely, you could go with a syntax that stands on its own rather than borrowing existing connotations:

  save-middle-earth!
However, I'm not sure any of these nullary call syntaxes gives you a clear translation to s-expressions. If "save-middle-earth." just becomes "((save-middle-earth))" and does nothing twice, that doesn't help. ^_^; (On the other hand, maybe you could make this work by treating ((x)) as a special case in the s-expression semantics.)

Here's a third (fourth? fifth?) option: Define (func call (f :rest args) (apply f args)).

  call save-middle-earth


1 point by seertaak 896 days ago | link

Thanks for the tip about the formatting!

No, currently attempting to evaluate () is an error (and a bad crash with no error message, I'm embarrassed to say! [but now fixed and pushed]).

Your argument regarding () is pretty convincing. It's a bad idea. But I find the full-stop notation a bit jarring, not sure why. I'll try it and see if I get used to it... And I didn't want to tread on the "!" real-estate, given that's it's commonly used in identifiers.

I have to say I still lean slightly towards preferring a default of invocation for 0-arity functions, and using the "val" (again, id) function for passing the function itself.

Maybe the best approach is to offer a define-syntax functionality which somehow corrects the anomality (by visiting the AST and reducing without evaluating) before applying the macro transform. But that's quite possibly another can of worms...

-----

1 point by seertaak 896 days ago | link

Having slept on this, I think I'm going to remove the (obj) ==> obj reduction. I think the gain is not enough to compensate the loss of transparency.

It's not even that big of a loss, since you can write:

    if (condition)
        true-clause   // 4-indent.
        false-clause

-----