Overloading the tilde operator?

greg greg at cosc.canterbury.ac.nz
Thu Feb 8 01:23:42 EST 2007


Dave Benjamin wrote:
> Neil Cerutti wrote:
> 
>> There's been only one (or two?) languages in history that
>> attempted to provide programmers with the ability to implement
>> new infix operators, including defining precedence level and
>> associativity (I can't think of the name right now).
> 
> You're probably thinking of SML or Haskell. OCaml also allows you to 
> define new infix operators, but the associativities are fixed (and 
> determined by what punctuation you use).

Prolog lets you do this, too.

In Smalltalk, you can use just about any sequence of
non-letters as an infix operator, but it has no notion
of precedence, even for the built-in operators.

I think SNOBOL may have had something for defining new
operators, but I can't remember the details.

--
Greg



More information about the Python-list mailing list