axiom-developer
[Top][All Lists]
Advanced

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

RE: [Axiom-developer] Convert and Coerce


From: Page, Bill
Subject: RE: [Axiom-developer] Convert and Coerce
Date: Mon, 27 Mar 2006 16:34:32 -0500

On Wednesday, March 22, 2006 12:10 AM Antoine Hersen asked:
> 
> I did not find much information about the difference between
> "convert" and "coerce".
> 
> Coerce is the "::" operator. But I did not find much more.
> 

Actually "::" is the conversion operator (which may include
coercions). The difference is that the Axiom interpreter can
do coercions automatically but you have to specify conversions
explicitly. In the Axiom compiler (both SPAD and Aldor) all
conversions and coercions must be specified.

Here is a little practice reading from the Axiom book :)

Page 152:

"A coercion is a special kind of conversion that Axiom is allowed to do
automatically
when you enter an expression. Coercions are usually somewhat safer than
more general
conversions. The Axiom library contains operations called coerce and
convert. Only
the coerce operations can be used by the interpreter to change an object
into an object
of another type unless you explicitly use a ::."

---------

Does that help? If it isn't clear, please ask.

Regards,
Bill Page.




reply via email to

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