[erlang-questions] Trouble with Erlang's lenient comparisons

Robert Virding robert.virding@REDACTED
Wed Apr 13 18:43:37 CEST 2011


You could, but then we would be getting way too many operators. In many ways the pure term comparison operators maybe be more needed as they would clean up issues with ordering terms (you can have two terms in which one is not greater or less than the other but they are not equal). If we wish to have specific operators then we could have two different prefixes for whether they are term or numeric comparisons, for example @ for term and : for numeric: 

@== @/= @=< @< @>= @> 
:== :/= :=< :< :>= :> 

Then phase out the old ones completely. This is the only way without causing too much grief. 

The question is, of course, how many problems do the existing operators actually cause, and is it worth trying to fix it? 

Robert 

----- "H. Diedrich" <hd2010@REDACTED> wrote: 
> 
> Robert Virding schrieb: 
> 

The comparison operators as they are now were a mistake, almost a bad mistake. IMAO what we should have done was to have had two different sets of operators, one set of numeric comparisons (without type conversion) and one set of gerneral term comparisons (without type conversion). So for example: 
> 
> == /= =< < >= > would only work on numbers 
> @== @/= @=< @< @>= @> would work on all terms 
> 
> Note that the existing =:= =/= are the same as @== @/= in my scheme above. 
> 
> We could add the full set of term comparison operators, but not change the existing operators 
> So you could introduce the @ variants for numbers only instead. How about a triple sign notation for "strictness", as ===, /==, ==< ... !? Well ... <=< ... :-< 
> 
> 
> Henning 
> _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110413/86404d89/attachment.htm>


More information about the erlang-questions mailing list