[EMAIL PROTECTED] wrote:
Actually I was thinking of something related the other day:
> Wouldn't it be nice to be able to define/overload not only
> operators but also control structures?

That triggered off something in my mind that's somewhat
different from what you went on to talk about.

So far we've been talking about ways of defining new
syntax. But operator overloading isn't creating new
syntax, it's giving a new meaning to existing syntax.
So the statement equivalent of that would be defining
new meanings for *existing* control structures!

For example, when you write

  while expr:
    ...

it gets turned into

  expr.__while__(thunk)

etc.

No, I'm not really serious about this -- it was just
a wild thought!

--
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,          | A citizen of NewZealandCorp, a       |
Christchurch, New Zealand          | wholly-owned subsidiary of USA Inc.  |
[EMAIL PROTECTED]          +--------------------------------------+
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to