[M3devel] Enumeration or subrange value out of range

Michael Richter ttmrichter at gmail.com
Thu Dec 2 13:51:08 CET 2010


On 2 December 2010 14:53, Jay K <jay.krell at cornell.edu> wrote:

>  + for String really is ok.
>

We will have to agree to disagree here.  I really cannot stand having
addition and concatenation using the same operator.  It bugs me at a very
profound level, even more than using left- and right-shift operators for
output and input.


>  At this point, probably millions of programmers are comfortable
>  with + being concat. At least in statically typed systems,
>  where 3 and "3" are clearly different.
>

At this point millions of programmers are comfortable programming without a
clean separation between interface and implementation.  I still prefer the
Modula series of languages and would not want them to change into an
abortion like C++.


>   > Any token that consists of purely "special symbols" is an operator that
>   > can be used directly as an operator
>
>  This changes the meaning of existing code in both C/C++ and Modula-3.
>
>  e.g.:
>    a:=+b;
>    a:=-b;
>    a:=--b;
>    a:=---b;
>

I wasn't actually suggesting that we directly use Haskell's system.  I was
just pointing out that it's trivial to allow operators to be defined by the
programmer without having the lexer communicating outside of the lexing
process.  It's a matter of language design.

Were I to retrofit a "define new operator" mechanism into an established
language like Modula-3, I'd probably insist that user-added operators be
wrapped in something like backquotes.  So a hypothetical concatenation
operator might become `++`.  Basically user-defined operators would have to
have some way to uniquely identify themselves as such to the lexer in the
absence of a language built from scratch to support them.


>  Still, I think there is plenty value in overloading existing operators.
>

There can be, yes.  It's just that I've seen more abuse of operator
overloading than I have good uses.  This makes me nervous of having them,
even though they *really are* damned convenient when used correctly.

-- 
"Perhaps people don't believe this, but throughout all of the discussions of
entering China our focus has really been what's best for the Chinese people.
It's not been about our revenue or profit or whatnot."
--Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20101202/93cfb47c/attachment-0002.html>


More information about the M3devel mailing list