[E-Lang] Hydro & E operator expansions

Ralph Hartley hartley@aic.nrl.navy.mil
Thu, 22 Mar 2001 16:11:05 -0500


Mark S. Miller wrote:

> So, on the particular issue, I find a "no coercion" position hard to 
> swallow: What about "3.1 + 4"?  However, motivated by Java-familiarity, I 
> probably did go overboard on string "+".  In E, your pair of examples would be:
> 
>     print("City: " + name + ", Location: " + north + " deg N, " + east + " deg E")

I have always hated that. Not only does it not give me any control of 
how many digits get printed, but I always end up writing (or failing to 
write)

print(""+5+6)  // I sometimes forget and say print(5+6) which prints 
"11" when I wanted "56".

and then I worry about operator presidence.

>     print(`City: $name, Location: $north deg N, $east deg E`)
> 
> or, with a hypothetical "format" (or "printf"?) quasi parser:
> 
>     print(format`City: %s$name, Location: %.1f$north deg N, %.1f$east deg E`)

Doesn't that need some sort of delimiter for the END of the variable 
names? What do I do if I don't want any white space after a number, but 
want a letter there instead?

Ralph Hartley