[M3devel] Enumeration or subrange value out of range

Jay K jay.krell at cornell.edu
Thu Dec 2 07:53:37 CET 2010


 > What is the FFI lingua franca again?  C or C++?

 
 C is fairly lingua franca, but how do I *efficiently* *portably*
 implement exception handling? NT, Tru64, VMS all extend C slightly
 to allow it. I don't believe C on any other system does.


 C also doesn't offer "good idioms" for operator overloading.
 Easy enough for a target language, but as we are discussing here,
 not for a source language.
 
  
 
 + for String really is ok.
 
 Java, C++, C#.
 I realize it has completely different meaning than for integers,
 but even float vs. int are quite different in what + means.
 You know, big + small float == big.
 
 
 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.
 
 
  > 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;

 
 Maybe this can be resolved though.
 Still, I think there is plenty value in overloading existing operators.
 As well, one might just go ahead and define new rules for "unused" characters,
 if we have any. e.g. tilde, percent?


  > What people pine for vs. what people need or at least can truly use are
  > such radically disjoint sets that I often use what people pine for as a
  > hint for what to avoid.


True.


  > How would you enforce a rule that says "<<" means that you are somehow
  > shifting something to the left


My proposal was, like, that + is always T +(T,T).
Similar for *, -, DIV.
For << I think it'd always be T <<(T, integer).
:= would also be, like, := (T designator?, T)


Granted, the semantic could still be arbitrary.
But you wouldn't be able to define the family:
  <<(stream, integer)
  <<(stream, text)
  <<(stream, float)


so that'd probably stop you from <<(stream, integer) meaning
to print an integer.


This limited form of operator overloading supports many scenarios.
It does not however support the Blitz++ construct that optimizes
all temporaries out of matrix/vector math.


  - Jay

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20101202/db37f630/attachment-0002.html>


More information about the M3devel mailing list