Ralf Hemmecke wrote:
> 
> >>     if % is List(S) then
> > 
> > You repeat the definition in category, I think repeat the definition
> > in domain would be better?
> 
> Certainly better to repeat in List domain. Logically, how would the
> category know about the actual representation of List. Furthermore,
> there might be other domains that gain from such repetition and thus
> inlining. So the domain is a more canonical place if the condition would
> be "% is ..." instead of "% has ...".

Well, putting definition in category makes it clear that source
code is identical and repetition is only for performance.
Actually, one can make actual definition into a macro and
just invoke it under different conditions, so actual duplication
of code can be minimized.

Spreading out copies in different places makes it harder to notice
that code is the same.  And without comment next year somebody
notices that we can drop "redundant" definitions.

Concerning "how would the category know", this is reponsibility
of bootstrap procedure: during final compilation "core domains"
(that is domains which may provide operations for inlining)
are available.

> The question is whether the compiler should not simply put the inherited
> the implementation of map! from the category into the domain, but rather
> "inherit" only the source code and compile again directly for the
> respective domain, i.e., perhaps inlining some parts. I've no clue
> whether that would be possible or a desireable behaviour of the compiler.

Possible with more advanced compiler (Aldor is close to this).
Desirable: yes if done in smat way.  Doing such things naively
may increase size of object code too much. 

-- 
                              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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to