On Tue, May 02, 2023 at 02:25:44PM +0200, Ralf Hemmecke wrote:
> Suppose, I have a category with a default function implementation and I
> define another category that inherits from the first one an gives another
> default implementation for that function.
> 
> Can I rely on the behaviour below?
> 
> I have tried this in Aldor and seem to remember that somewhere in the Aldor
> description it deliberately leaves it unspecified in which order the
> defaults are taken. Indeed Aldor yields different results.
> 
> I guess I also shouldn't rely on the current behaviour of the SPAD compiler,
> right?

Well, Spad search for functions is sequential with well specified
order.  There may be subtleties due to overloading (say you indeded
types to be equal but they are not) and conditions (if conditions
are not satisfied than search will use later functions that satisfies
conditins), but in general this should be stable.

Look at (sub)chapter 14.2.2 in the FriCAS book, there is part
about search path.  Also, Daventport article about Schratchpas II
design gives a lot of details.

IIRC rules are: domain inheritance first, then tree of categories with
depth-first search where order of arguments to Join gives order
on parents.

It is probably not wise to depend on order being depth-first (people
may change order of arguments to Join), but within linear inheritance
chain order should be reliable.

-- 
                              Waldek Hebisch

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/20230502140746.57vg3pfwcaaslkjd%40fricas.math.uni.wroc.pl.

Reply via email to