Bill Page <[email protected]> writes:

| Doesn't the compiler already know that the value of res is returned
| from the function?

No.  At the point where the compiler is processing the local assignment

           res := 1

it has no clue that it will be used later as the retuned value.


| Therefore infers that res must be of type % ? 

Nope, that is not the way the compiler works in all AXIOMs.

| Even
| in
| 
|   zero? n => 1
| 
| you have the question of what is type of 1.

No.  That line says "return this value", consequently, it checks the
return value (1) in the context of expected return type.

That does not hold for the assignment, because at that point, the
assignment is not type checked in the context of return type.  Rather,
it is type checked in the context of "don't care about value" --
technically $NoValueMode in the compiler.

-- Gaby

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