>> And if you just have CatD instead of Cat(D), you can achieve the
>> same thing.
> When does one have CatD?
Actually always. If you write D in your source file then you must know
it's type. Either you define D in that file or it comes from a library
or it appears as a parameter in the function (or constructor) in whose
body D occurs. In each case you know CatD.
You might argue that as an argument the type is not completely clear,
but if, for example, you define
A(D: Ring): with ... == add E
then all you know about D inside E is that its type is Ring even if it
can be something more specific like Field. But the compiler will not let
you access any Field operations unless you wrap it by
if D has Field than {
-- code here ---
}
> Do you mean that I must find and copy this
> from the source code? For example, how can I find the specific
> category (-ies) to which the domain 'Integer' belongs? Isn't this
> problematic if there are anonymous 'with' clauses present in the
> definition of Integer?
Before we go deeper here, can you give a concrete use case where this
"Cat" operation you mentioned is a good idea? Unfortunately, I cannot
remember the occasion when Stephen Watt said something about it.
>> Parametrization would only make sense to me if that definition of
>> NewD appears inside the "add" of a constructor Foo that has D as
>> a parameter. But in that case the category of D (that is actually useful)
>> is known from the definition of Foo.
> I am speaking loosely here, but I did not think of the D above as a
> parameter, but rather a globally known domain perhaps made in scope by
> a prior )expose or import command.
It seems you are very much interpreter focused. That in the interpreter
I might have problems to figure out the type of a domain it natural
since everything is interactive an thus dynamic. But I am currently not
interested in such things. With a bit of reflection built into Aldor,
one could write an interpreter in Aldor. But I don't think it is
generally desireable to make reflection available to the general user.
>> So what did you have in mind with the above?
> The whole point is to be able to define specifically the category to
> which a domain belongs, i.e. the actual type of a domain constructor.
> And then to be able to use that type in the definition of another
> domain.
OK. But suppose you are writing a library (no interpreter) and you have
the above.
Somewhere in your library a domain D is defined. You define
NewD: Cat(D) with
foo: %->%
== D add
foo(x: %): % == x
bar(X: MyCat): () == ...
How do you know that you can write bar(D)?
How do you know that you can write bar(NewD)?
I don't currently see a case where I would want such a NewD. Do you have
a real example?
Ralf
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en
-~----------~----~----~----~------~----~------~--~---