> Let's use the example from the origin post:
>
> FOOCAT is the category, FOOCAT- is the default domain the implements
> part of FOOCAT, FOOPKG is the package that uses FOOCAT-.
>
> Now, the information about FOOCAT- is not mentioned in FOOCAT.NRLIB
> at all. It is inserted in FOOPKG during compilation.
>
> So if we issue ")library FOOCAT" to a fresh system, then we have
> no information about FOOCAT- in the database.
Yes, that's seemingly true. But while I was looking a bit deeper I saw
showdatabase.
https://github.com/fricas/fricas/blob/master/src/interp/daase.lisp#L585
I used it to show me what information I can get. Indeed for
)lisp (showdatabase '|FooCat|)
I get ... (see end of mail). Most interestingly, the entry DEFAULTDOMAIN
shows NIL. I don't know whether this entry will be ever set, because in
daase.lisp one finds
=======================================
; there are only a small number of categories that have default domains.
; rather than keep this slot in every domain we maintain a list here.
(defvar |$defaultdomain_list| '(
(|MultisetAggregate| |Multiset|)
(|FunctionSpace| |Expression|)
(|AlgebraicallyClosedFunctionSpace| |Expression|)
(|ThreeSpaceCategory| |ThreeSpace|)
(|DequeueAggregate| |Dequeue|)
(|ComplexCategory| |Complex|)
(|LazyStreamAggregate| |Stream|)
(|AssociationListAggregate| |AssociationList|)
(|QuaternionCategory| |Quaternion|)
(|PriorityQueueAggregate| |Heap|)
(|PointCategory| |Point|)
(|PlottableSpaceCurveCategory| |Plot3D|)
(|PermutationCategory| |Permutation|)
(|StringCategory| |String|)
(|FileNameCategory| |FileName|)
(|OctonionCategory| |Octonion|)))
=========================================
Maybe I misinterpret the semantics of "defaultdomain", but this list has
certainly nothing to do with the default/add domain of a category,
otherwise I would see KeyedDictionary there.
Anyway, apart from this problem with defaultdomain, a strategy to find
where )lib should look for the a (possible) default package, could be to
simply check whether in ")lib FooCat" FooCat is a category
(15) -> )lisp (getdatabase '|FooCat| 'constructorkind)
Value = |category|
and if it is, to probe FooCat& (i.e. name with "&" appended).
(15) -> )lisp (getdatabase '|FooCat&| 'object)
Value = "/home/hemmecke/scratch/FOOCAT-.NRLIB/FOOCAT-"
Concerning a fix for Aldor...
There does not seem to be any problem at all as the attached bar*.*
files show. Everything works fine. The default package seems to be
loaded when ")lib barcat" is issued.
Running foocomp.input works fine while foolib.input (in a fresh session)
gives
(2) -> foozwei(1)$F
>> System error:
The index 1 is too large.
To me it just makes sense to fix FriCAS so that it automatically load a
default package of a category if the category is loaded via the )lib
command.
Waldek, do you think, it makes sense to follow the above strategy to
prepare a patch for such a fix?
Ralf
===================================================================
)lisp (showdatabase '|FooCat|)
CONSTRUCTORKIND: category
COSIG: (NIL T T)
OPERATION: NIL
CONSTRUCTORMODEMAP:
(((|FooCat| |#1| |#2|) (|Category|) (|EuclideanDomain|) (|Ring|)) (T
|FooCat|))
CONSTRUCTORCATEGORY:
(|Join|
(CATEGORY |package|
(SIGNATURE |relationsIdealGenerators|
((|List| (|Polynomial| |t#1|)) (|List| |t#2|)))
(SIGNATURE |etaQuotientIdealGenerators|
((|List| (|Polynomial| |t#1|)) (|NonNegativeInteger|)
(|List| (|List| (|Integer|)))))))
OPERATIONALIST:
((|relationsIdealGenerators| (((|List| (|Polynomial| |#1|)) (|List|
|#2|)) 6))
(|etaQuotientIdealGenerators|
(((|List| (|Polynomial| |#1|)) (|NonNegativeInteger|)
(|List| (|List| (|Integer|))))
6)))
MODEMAPS:
((|etaQuotientIdealGenerators| (*1 *2 *3 *4)
(AND (|isDomain| *3 (|NonNegativeInteger|))
(|isDomain| *4 (|List| (|List| (|Integer|))))
(|ofCategory| *1 (|FooCat| *5 *6)) (|ofCategory| *5
(|EuclideanDomain|))
(|ofCategory| *6 (|Ring|)) (|isDomain| *2 (|List| (|Polynomial|
*5)))))
(|relationsIdealGenerators| (*1 *2 *3)
(AND (|isDomain| *3 (|List| *5)) (|ofCategory| *1 (|FooCat| *4 *5))
(|ofCategory| *4 (|EuclideanDomain|)) (|ofCategory| *5 (|Ring|))
(|isDomain| *2 (|List| (|Polynomial| *4))))))
HASCATEGORY: NIL
OBJECT: /home/hemmecke/scratch/FOOCAT.NRLIB/FOOCAT
NILADIC: NIL
ABBREVIATION: FOOCAT
CONSTRUCTOR?: T
CONSTRUCTOR: NIL
DEFAULTDOMAIN: NIL
ANCESTORS: NIL
SOURCEFILE: /home/hemmecke/scratch/foo.spad
CONSTRUCTORFORM: (FooCat C L)
CONSTRUCTORARGS: (C L)
PREDICATES:
NIL
DOCUMENTATION: NIL
PARENTS: NIL
Value = NIL