JarrettBillingsley / Croc

Croc is an extensible extension language in the vein of Lua, which also wishes it were a standalone language. Also it's fun.
http://www.croc-lang.org
79 stars 12 forks source link

Remove arithmetic/bitwise metamethods? #60

Closed JarrettBillingsley closed 11 years ago

JarrettBillingsley commented 12 years ago

This includes op(Add|Sub|Mul|Div|Mod|And|Or|Xor|Shl|Shr|UShr)(Assign|_r)? and op(Neg|Com|Inc|Dec). Honestly I just don't see them being that useful. Croc has no value types and therefore anything that implements these correctly is going to generate a ton of heap-allocated intermediates. It's one of the reasons I haven't really made any inroads on the bignum thing -- I'd rather not make the "easy" case grossly inefficient. And other than bignums (and what Vector uses them for), is there really that much of a use case? Seriously, how often do you really need to implement "numbers"?

This pretty much just leaves op(Index|Slice|Field|Length)(Assign)?, opCat(Assign|_r)?, opCmp, opEquals, opCall, opMethod, opApply, and opIn. Most of these are useful for containers, which are much more common. What's left is either generally useful (opCmp/opEquals) or used to mock other behaviors.