2 points on language

S.D.Mechveliani mechvel@math.botik.ru
Fri, 24 Aug 2001 12:35:38 +0400


To my 

> Anyway, if a compiler `knows' the word  CommutativeRing, 
> [..]
>                        expr = (2*a + b) - (a+a)  :: T 
> 
> and sees the language version (compiler) flag     -fignore-bottom,
> (something of this sort) then, has it right to convert  
>                          
>                        expr --> b :: T
> ?
> [..]


D. Tweed <tweed@compsci.bristol.ac.uk> writes

> On a purely pragmatic note ( :-) ) these optimisations can't necessarily
> be safely used in three of the four most common cases, namely Int, Float
> and Double because of the restricted range of intermediates. 
> [..]


Int, Float, Double  
are not supposed to be provided with the  CommutativeRing  instance.
And most common cases are, to my mind, different:
Integer, Rational, (Integer, Rational), Polynomial Integer ...

Regards,

-----------------
Serge Mechveliani
mechvel@botik.ru