lua-users home
lua-l archive

Re: Is there a reason why __eq, __lt, __le metamethods enforce returning booleans?

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great Dirk Laurie once stated:
> 
> Look, the notation "a<b" to mean a non-boolean is so counterintuitive, why
> not use just say "a|b" which can return whatever? Or have you used up all
> the binary operators already?
 I wrote a language in college were you could overload operators and have
them return anything. Including "<" and ">". Because of that, I was able
to implement a Unix shell rather easily. Unix commands were first class
objects and they overrode "<" amd ">" to allow redirection of stdin and
stdout.
 So in that context, it's not at all counterintuitive. It's just what you
are used to.
 -spc (Never thought of the horror that could happen if you tried to sort
	an array of Unix commands ... )

AltStyle によって変換されたページ (->オリジナル) /