"Bill Page" <[EMAIL PROTECTED]> writes:
> 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'?
because "op" is on the left hand side of ":".
> >> 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.
Yes, but this is not what is actually implemented. For example, after defining
a function "f" in the interpreter, the interpreter thinks that the type of "f"
is "FunctionCalled f".
> >> 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"?
I added "perhaps" on purpose! I think that
f(i: INT): EXPR INT == x^i
is bad practise, but with the current interpreter, it's encouraged. It should
(probably) be
f(i: INT): EXPR INT == 'x^i
unless we really intend to use the global x. I'm not sure though whether this
really is the same issue.
> > (I believe that sage does not do that:
> >
>
> Sage does something different and rather adhoc. Try:
>
> sage: x
OK. I don't think that's wise, but at least "?x" tells you why.
> > 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.
OK, I agree that it is a possible way to redefine the semantics, but I'm not
convinced that it is a good idea. In particular, Symbol would have to be a
domain known to the language, similar to "->". Probably quite OK.
> > 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.
nothing, only that I cannot demonstrate what I wanted to in Axiom.
Martin
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---