It is not likely to change soon, but I would prefer to keep such
code limited to small number of crucial places.
>
> Actually, the question arises whether introspection should be allowed at
> all. If yes, then all supported forms should make it into a package.
IMO introspection is clearly needed, otherwise some natural
conditions on types are not possible (which in particular led to
hack above in 'polycat.spad'). Tricky part is to give exact
rules. In particular, currently types are of type 'Category',
but almost all that can be done with categories is buit into
compiler. Interpreter can only use categories created by
compiler and there is bunch of functions in runtime support.
ATM it is not clear if we should turn 'Category' into an actual
type. Logicaly things like type name or arguments are operations
on types, that is operation in elements of type 'Category'
so should be among exports of Category'... But trurly first
class categories lead to serious problems, so probably it is
better to just build needed support into compiler and
interpreter.
> On 9/27/20 2:09 PM, Ralf Hemmecke wrote:
> > I would like to get the name of a type as a string.
> > In a FriCAS session I can simply do
> >
> > (15) -> unparse(Integer :: InputForm)
> >
> > Function Selection for unparse
> > Arguments: INFORM
> >
> > [1] signature: INFORM -> STRING
> > implemented: slot (String)$ from INFORM
> >
> >
> > (15) "Integer()"
> > Type: String
> >
> > Unfortunately, that doesn't work in the compiler.
> >
> > Is there a simple way to get the name or do I have to use some trick?
> >
Well, ATM there is Boot function 'typeToForm' which can coerce type
to InputForm or OutputForm. There is also 'outputDomainConstructor'
which is more naive, but should work before algebra bootstrap
('typeToForm' recures to algebra so is usable only after
bootstrap).
--
Waldek Hebisch