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

Re: what most every language is missing :-)

> How about adding a "might-equal" operator?  I recommend useng the
> characters "=?".

You've almost got it. Try "?=". :)

Eiffel (use it primarily at work) has such an operator, namely the
"reverse assignment attempt" or "conditional assignment". The statement

   x ?= y

has two possible effects. If, at runtime, y is attached to an object of a
type conforming to the type of x, then x too will be attached to that
object; otherwise x will be void (null).

It's not my favorite part of the language, but it's the closest you get to
having an "instance_of"-like operation. I believe it's deliberately
cumbersome, to drive programmers towards dynamic binding.