Language Question

Programming, for all ages and all languages.
Post Reply
Crazed123

Language Question

Post by Crazed123 »

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?
Schol-R-LEA

Re:Language Question

Post by Schol-R-LEA »

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.
Crazed123

Re:Language Question

Post by Crazed123 »

Because it seems to me to make a lot of sense to be able to say "this is how you treat blah". Just interested.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Language Question

Post by Candy »

Schol-R-LEA wrote: SML, Miranda, Algol-68 and the original Ada. Haskell, too, I think, but I'd have to check.
I can confirm Haskell, although I dislike the syntax to do so.
Post Reply