apricot-lang / apricot

Clojure-like Lisp on Rubinius
94 stars 7 forks source link

Expand Send Shorthand #7

Closed causal-agent closed 11 years ago

causal-agent commented 12 years ago

Clojure expands the shorthand form of method sends at macro expansion time:

(.toString 1) ;=> (. 1 toString)

Apricot should expand the following:

(.upcase "foo") ;=> (. "foo" upcase)
(Array. 3 :foo) ;=> (. Array new 3 :foo)
solson commented 12 years ago

Here are two more expansions in Clojure we may want to consider:

(Classname/staticMethod args*) ==> (. Classname staticMethod args*)
Classname/staticField ==> (. Classname staticField)
solson commented 12 years ago

The (.to_s 12) part of this is now implemented. Parsing Array. is a bit problematic as the parser currently sees it as an invalid Constant.

solson commented 12 years ago

This is waiting on #30.

solson commented 11 years ago

Everything in the OP has now been implemented.