[E-Lang] Hydro & E operator expansions

Tyler Close tclose@oilspace.com
Wed, 21 Mar 2001 09:06:32 -0000


MarkM wrote:
> At 04:40 PM Tuesday 3/20/01, Dean Tribble wrote:
>
> >>Does anyone object to this Python-like style of naming
> operator expansions?
> >
> >The only concern I have with the Python-style renaming is
> that the message
> >names are not meaningful to any existing class or library.
>  Thus, they
> >don't, play well with external libraries.  Is there an
> easy way to deal with
> >that?
>
> Yes.  The E-to-Java binding mechanism easily "adds" methods
> to Java classes
> as seen through E colored glasses.

I can also easily add and remove methods in Acid. I therefore rescind
my suggested operator expansion names in favour of the "op__plus"
style syntax. The only remaining operator expansion to discuss is the
"()" operator. Consistency would suggest that it also be named
"op_invoke", but I expect that you'll argue against this.

I still think the operator message semantics that I proposed are
correct. I've got no problem with "+" being asymmetric for maps. The
resulting syntax is clean, easily understood and requires no
modification of the E language. I will also note that E already has an
asymmetric "+" operator with the String class "+".

The following is valid:

	def five := "" + 5

The following is not valid:

	def five := 5 + ""

I'll also refer you back to the original Hydro e-lang discussion in
which I explained why any assignment style syntax is wrong. The
operation is not assignment, it's addition. Note that at this point in
time (with the "." syntax in the pocket) you have the oportunity to
make the ":=" operator a purely built-in operator that never gets
expanded to anything. You can trust that an assignment is an
assignment.

Tyler