On 03/11/15 21:00, Waldek Hebisch wrote:
Well, I have to make my mind. Davenport writes that there should
be subsumption, but actually does not write why. Reasons that
I can give are rather weak. OTOH there are several places in
Spad compiler implementing this feature and it is intertwined
with other features, so if we decide to change behavior it
will take time.
In some ways it would be good to go beyond this and implement 'multiple
dispatch' AKA 'polymorphic method invocation'. Or is that what you meant?
That is: function calls are not bound, at compile time, based on the
static types of arguments but are bound depending on the actual type
argument that is passed at runtime.
This allows a more Haskell-like style of programming.
As Ralf says, instead of one big function:
Foo(R: Ring): with
....
if R has Field then ...
We have multiple small functions:
Foo(R: Ring): with
....
Foo(R: Field): with
....
Which may be easier to read (especially if you are used to Haskell)?
divides the code into smaller chunks, and allows new types to be added
without changing existing functions.
Martin
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.