ClojureScript

Try compiler macros for math ops

Details

  • Type: Defect Defect
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

I've made it so macro expansion stops when expansion does not differ from source form. This combined with the fact that we have separate Clojure namespaces for macros means that ordinary macros can act as compiler macros in cljs. Just define a macro with the same name as the function.

Note that you will need the complete definition of the function as well - it will be used when the function is used as a value, or via some alias. The macro will only come into play when compiler sees call by original name.

Try this on e.g. * and report back.

Imported from github issue #15

Activity

Hide
David Nolen added a comment -

I've started on this, https://github.com/clojure/clojurescript/tree/4-math-op-macros. Seems to works as advertised, however for some reason function printing gets borked.

Show
David Nolen added a comment - I've started on this, https://github.com/clojure/clojurescript/tree/4-math-op-macros. Seems to works as advertised, however for some reason function printing gets borked.
Hide
Chouser added a comment -

Later

Show
Chouser added a comment - Later

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: