On Fri, Aug 29, 2008 at 3:42 AM, Martin Rubey wrote:
>
> Bill Page writes:
>
>> If I define:
>>
>> Foo(op:Symbol,A:Type):Category == with op:(%,%)->A
>>
>> What do expect a domain
>>
>> Bar():Foo('+,Integer)
>>
>> to export?
>
> a single operation named "op"
But of course you do expect this operation (whatever it's name) to
return a value of the domain Integer. Why should 'op' be treated
differently than 'A'?
>
>> What do you expect to occur on the left side of the : in a declaration?
>>
>> x:y
>>
>> It seems to me that x must be a symbol. No?
>
> No, x is an identifier, whose type is y, and who hasn't yet been given a
> value.
>
The glossary of the Axiom book contains the following definition:
identifier
(syntax) an Axiom name; a literal of type Symbol. An identifier begins
with an alphabetical character, %, ?, or !, and may be followed by
any of these or digits. Certain distinguished reserved words are
not allowed as identifiers but have special meaning in Axiom.
--------
>> In Axiom symbols are values of the domain Symbol.
>
> Yes, but x is not a symbol. It is only a convenience (perhaps an
> unfortunate one) for the user that in the Axiom interpreter, every
> symbol-like literal is interpreted as an identifier of type Symbol with
> value being it's name.
Why do you say "unfortunate"? Actually, it is a little more
complicated. Undeclared "identifiers" are evaluated as the value of
the domain constructor 'Variable(identifier)'. There is a coercion
possible from Variable to Symbol so this does not lead to any obvious
restrictions but it is not clear to me why the interpreter uses
'Variable' at all.
> (I believe that sage does not do that:
>
Sage does something different and rather adhoc. Try:
sage: x
> ...
> This distinction between identifiers and values makes programming much
> easier and less error-prone.
>
I am not convinced that is true. In a statically typed language, I
expect there might be some restrictions on the use of symbols as
values similar to the restrictions on type expressions, i.e. they must
be "constant in context" so that that compiler can actually determine
types and names at compile time. But the suggested use of symbols in
category definitions meets this criterion.
> Unfortunately, Axiom does not support overloading of constants in
> the interpreter (in fact, there is no such thing as a constant), but in
> Aldor I can nicely illustrate what I mean:
> ...
I agree that this is a deficiency of Axiom, but I am no sure what this
has to do with symbols and identifiers.
Regards,
Bill Page.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---