To make it simple: you are stressing the interpreter and not SPAD.

What I now say is a guess, but I am pretty confident that this is the reason since...

(1) -> g(12)$Test(Float)

   (1)  12.0
                                              Type: Float

works as expected.

In order to figure out what you mean by "g 12", the interpreter must look for a function that takes an integer. There is no such function.

Seemingly in your first case the interpreter is able to figure out that there were a function g that is reasonably close.

It has to do two things. First, it must figure out how to package-call g, i.e. it must find a reasonable parameter for "R: Ring". Integer will do in this case. (I'm not at all sure whether the interpreter chooses INT here, but it would be my first guess.) Then it finds g: Float->Float so the interpreter has the convert 12 to Float, before calling g. Since all that works, you are lucky in the first case.

In the second case, you basically ask the interpreter to figure out a domain that can be put in the argument of Test, i.e. fulfills the category Algebra(Float). Seemingly, you simply ask too much from the interpreter and thus it fails to find g.

Does that help?

Ralf

On 07/07/2011 05:57 PM, Yrogirg wrote:
I'm trying to understand the difference between the next two dummy
packages. The first one

)abbrev package TST Test

Test(R: Ring): with
     g : Float ->  Float
  == add
     g y == y

and it works as I expect:

(4) ->  g 12

    (4)  12.0
                    Type: Float

but a slightly different version

)abbrev package TST Test

Test(R: Algebra(Float)): with
     g : Float ->  Float
  == add
     g y == y

doesn't work:

--
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.

Reply via email to