[M3devel] Enumeration or subrange value out of range

Mika Nystrom mika at async.async.caltech.edu
Wed Dec 1 08:55:49 CET 2010


I think if you want overloaded operators, you code in Scheme or your
own invented language and write a little compiler/translator (to C
or Modula-3, for example), for the particular expressions you want
to convert.  You can have whatever crazy syntax and features you want
if you do it that way, and it doesn't gum up everyone else's day...

    Mika

P.S. People were listing things they liked about Modula-3 a few days ago.
I'm surprised no one mentioned my favorite properties:

-- no possibility of breaking existing code by adding new symbols to 
   an interface, no matter how public

-- no possibility of breaking existing code by adding new methods to
   an object type, no matter how widely exported or how widely used
   or "subclassed"

about how many other programming languages can you say that?  (Note also
that these features are on a quite different level from Jay's list...)

Jay K writes:
>--_25139682-7cce-49b1-ae17-6a4dff3488ee_
>Content-Type: text/plain; charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
>
>
>opportunities to optimize calculations (like your example with intermediate=
> forms for matrix manipulations)
>Just to be clear=2C that power is not easily created=2C and would not be do=
>-able in the constrained form I suggested=2C where it is always=2C e.g. T +=
>(T=2CT)
>
> >  not proper in terms of semantics (operator<< and operator>> being obvio=
>us cases)
>
>This would not be allowed in my constrained proposal.
>
>> but also operator+ for concatenation
>
>This is very reasonable.
>
> > utterly painful uses for operator=2C)
>
>
>I'm surprised that is overloadable=2C but indeed it appears it is. I don't =
>think I have *ever* seen anyone overload it=2C and I have seen a lot.
>
>
>
> > the inability to define new operators (which leads to the first problem =
>of idiots redefining the semantics of operators)
>
>
>Stroupstroup rejected this as too complex. (See the Design&Evolution book).
>I don't see people pine for this often and I suspect he did the right thing=
>.
>It creates a layering problem I believe in the typical structure.
>The lexical analysis would have to get information from higher layers.
>
>
> > unexpected costs to operations making the eyeballing of execution comple=
>xity (time-wise and memory-wise) literally impossible
>
>
>This is already the case. As I said. So let's say that every single functio=
>n call is shown. It is hard to know which functions have which cost.
>There are also hidden function calls e.g. for "try" and every pointer derer=
>eference (right?)
>
>
>Please consider floating point. Historically floating point was "soft float=
>". Sometimes these days it still us. Yet we still have operators for floati=
>ng point.
>Why? Because it is just so convenient and idiomatic. Why stop there?
>
>
>A primary design point of C++ is to give user defined types all the powers =
>of built in types.
>No longer does it require a compiler change to introduce a type with the "p=
>ower" of int. And so on.
>
>
>
>> painful interaction with templates that makes a perfect storm of eye-dama=
>ging syntax
>Huh? Specifically?
>
>The one vague reason I don't fully understand is: C doesn't have it.
>Does C represent a good example of a sort of minimalism? Maybe.
>It isn't clear to me the value of C. It has been *very* widely abandoned in=
> favor of C++.
>
> - Jay
> 		 	   		  =
>
>--_25139682-7cce-49b1-ae17-6a4dff3488ee_
>Content-Type: text/html; charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
><html>
><head>
><style><!--
>.hmmessage P
>{
>margin:0px=3B
>padding:0px
>}
>body.hmmessage
>{
>font-size: 10pt=3B
>font-family:Tahoma
>}
>--></style>
></head>
><body class=3D'hmmessage'>
><br><ul><li>opportunities to optimize calculations (like your example with =
>intermediate forms for matrix manipulations)</li></ul><br>Just to be clear=
>=2C that power is not easily created=2C and would not be do-able in the con=
>strained form I suggested=2C where it is always=2C e.g. T +(T=2CT)<br><br><=
>div class=3D"ecxgmail_quote">&nbsp=3B&gt=3B&nbsp=3B <b>not</b>&nbsp=3Bprope=
>r in terms of semantics (<font style=3D"" class=3D"ecxApple-style-span" fac=
>e=3D"'courier new'=2C monospace">operator&lt=3B&lt=3B</font> and <font styl=
>e=3D"" class=3D"ecxApple-style-span" face=3D"'courier new'=2C monospace">op=
>erator&gt=3B&gt=3B</font> being obvious cases)<br><br>This would not be all=
>owed in my constrained proposal.<br><br>&gt=3B but also <font style=3D"" cl=
>ass=3D"ecxApple-style-span" face=3D"'courier new'=2C monospace">operator+</=
>font> for concatenation<br><br>This is very reasonable.<br><br>&nbsp=3B&gt=
>=3B utterly painful uses for <font style=3D"" class=3D"ecxApple-style-span"=
> face=3D"'courier new'=2C monospace">operator=2C</font>)<br><br><br>I'm sur=
>prised that is overloadable=2C but indeed it appears it is. I don't think I=
> have *ever* seen anyone overload it=2C and I have seen a lot.<br>
><br><br>&nbsp=3B&gt=3B the inability to define <b>new</b>&nbsp=3Boperators =
>(which leads to the first problem of idiots redefining the semantics of ope=
>rators)<br><br><br>Stroupstroup rejected this as too complex. (See the Desi=
>gn&amp=3BEvolution book).<br>I don't see people pine for this often and I s=
>uspect he did the right thing.<br>It creates a layering problem I believe i=
>n the typical structure.<br>The lexical analysis would have to get informat=
>ion from higher layers.<br><br><br>&nbsp=3B&gt=3B unexpected costs to opera=
>tions making the eyeballing of execution complexity (time-wise and memory-w=
>ise) literally impossible<br><br><br>This is already the case. As I said. S=
>o let's say that every single function call is shown. It is hard to know wh=
>ich functions have which cost.<br>There are also hidden function calls e.g.=
> for "try" and every pointer derereference (right?)<br><br><br>Please consi=
>der floating point. Historically floating point was "soft float". Sometimes=
> these days it still us. Yet we still have operators for floating point.<br=
>>Why? Because it is just so convenient and idiomatic. Why stop there?<br><b=
>r><br>A primary design point of C++ is to give user defined types all the p=
>owers of built in types.<br>No longer does it require a compiler change to =
>introduce a type with the "power" of int. And so on.<br><br><br>
>&gt=3B painful interaction with templates that makes a perfect storm of eye=
>-damaging syntax</div><br>Huh? Specifically?<br><br>The one vague reason I =
>don't fully understand is: C doesn't have it.<br>Does C represent a good ex=
>ample of a sort of minimalism? Maybe.<br>It isn't clear to me the value of =
>C. It has been *very* widely abandoned in favor of C++.<br><br>&nbsp=3B- Ja=
>y<br> 		 	   		  </body>
></html>=
>
>--_25139682-7cce-49b1-ae17-6a4dff3488ee_--



More information about the M3devel mailing list