[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] [Fraction] A suggestion for MyFraction in Aldor (draft

From: Ralf Hemmecke
Subject: [Axiom-developer] [Fraction] A suggestion for MyFraction in Aldor (draft)
Date: Tue, 07 Feb 2006 06:51:14 -0600


-++ based on a suggestiong by Ralf Hammecke
++ based on a suggestion by Ralf Hemmecke


Comment from Ralf Hemmecke to the above code: 
How can a compiler find out which function to call if one says something like::

           zero?(x:%) == zero? x

To me this looks like a recursive definition :-( Fortunately, the Aldor 
compiler will complain at
such ambiguous definitions.

If the compiler can figure out which function 'zero?' it should put into the 
second place, fine.
But then the argument type for that function is wrong. There must be an 
implicit (hidden) conversion from % to S.

As a human I would have a very hard time to understand the code if I haven't 
heard about the convention that
functions that end in a question mark return [Boolean]. Maybe 'zero?(x)' 
returns 1 for 'x=0' and zero otherwise.

It somehow doesn't fit together, writing pamphlets and ambiguous code. Always 
put the type information into the code!
Adding a bit of redundancy is certainly appreciated by other developers.

forwarded from

reply via email to

[Prev in Thread] Current Thread [Next in Thread]