hylang / hy

A dialect of Lisp that's embedded in Python
http://hylang.org
Other
5.14k stars 372 forks source link

move defmulti into core and rename to something sensible #912

Closed gilch closed 7 years ago

gilch commented 9 years ago

My improved partition #878, is kind of waiting on this. I'm kind of considering a pull without Clojure's argument order so I don't have to.

We've established that defmulti is a terrible name, since it's not actually multimethods, but just Clojure-style arity overloading. Unlike Python's usual arity overloading options--optional arguments and tuple packing--Hy's defmulti still supports keywords properly when the argument order changes.

If we can get this in core, I think it should just be baked into defn rather than getting a new name. The defn macro will have to detect if it's being used as defmulti instead of a def fn.

Kodiologist commented 7 years ago

Does #1050 meet your need here?

gilch commented 7 years ago

I think it does. I did implement the improved partition #928, but had to change the argument order from Clojure's, since Clojure-style arity overloading still isn't available in core. I'm not sure we should move it into core just yet though.

Kodiologist commented 7 years ago

Yeah, I think going by our new policy for hy.contrib, it should stay in hy.contrib for a while, till it's been battle-tested and we're fairly sure we like it how it is. Then we can move it to core.