Language Question
Language Question
Here's a language question: is there any language that has a dynamic data-types feature where you can overload operators (including =) without having to refer to the data as an object?
Re:Language Question
SML, Miranda, Algol-68 and the original Ada. Haskell, too, I think, but I'd have to check.
I'd mention Common Lisp but it doesn't really have a concept of 'operators' in the usual infix sense, and while you can override functions, you can't actually overload them IIRC.
If you don't mind me inquiring, why do you ask?
Most language designers today consider operator overloading a Bad Thing, really. While it gains some leverage as syntactic sugar, it has considerable potential for confusion, much more so than overloaded functions.
I'd mention Common Lisp but it doesn't really have a concept of 'operators' in the usual infix sense, and while you can override functions, you can't actually overload them IIRC.
If you don't mind me inquiring, why do you ask?
Most language designers today consider operator overloading a Bad Thing, really. While it gains some leverage as syntactic sugar, it has considerable potential for confusion, much more so than overloaded functions.
Re:Language Question
Because it seems to me to make a lot of sense to be able to say "this is how you treat blah". Just interested.
Re:Language Question
I can confirm Haskell, although I dislike the syntax to do so.Schol-R-LEA wrote: SML, Miranda, Algol-68 and the original Ada. Haskell, too, I think, but I'd have to check.