On 4/3/24 18:41, Waldek Hebisch wrote:
Well, AFAICS this is one of limitations of current compiler: 'error'
gets special treatment, but only when it is translated to Boot
function called 'error'.  If you rename 'error3' to 'error', then
the file will compile.  But I expect that such rename will cause
trouble, so I do not think it is a practical solution.

That actually brings me to the question whether overloading in BOOT is also supposed to work, i.e., whether I can have

error(x) == errorSupervisor($AlgebraError,x)

error(con, fun, mess) ==
errorSupervisor($AlgebraError, [STRCONC(fun, '" $ ", con, '": "), mess])

at the same time. I guess no.

BTW: my guess is that trouble is due to following pattern:

                 piv2 = 0 => error "impossible 3"
                 ...
                 lf1 := rquo(rp, rw)
                 lf1 := lf1 + nc2*lop

Thanks to special treatment of 'error' compiler knows that
lf1 is well defined at the end of this sequence.  But
without special treatment compiler thinks that 'lf1' may
be undefined when the sequence is finished.

One could work around this by giving lf1 and rf1 explicit
type declarations at start of 'lift1', like:

         lf1 : YDP
         rf1 : YDP

but this is somewhat suboptimal, as it needs more code and
weakens compiler checking.

OK, that would have been something that I would have tried to do, but I could not see how this would be related to the error3 function. Even now I do not quite see it. Looks like type checking is done after compForm1 was executed so that the typechecker sees error3 and does not know that this, in fact, includes a RETURN-FROM-FUNCTION.

OK, that are compiler internals that I am not so much interested in.
However, your statement about the declarations bothered me a bit.
First of all, I do not think that declaring the types of variables is a bad idea, since it is an easy hint for the programmer to understand the code. So that point of your "suboptimal" does not count for me. However, you say something about "weakens compiler checking", and that I don't understand at all. Up to know I would have guessed that when I declare the type of a variable, the compiler also checks that in places where this variable is used (or assigned), the actual types match with what I have declared. Is this not the case?

Ralf

--
You received this message because you are subscribed to the Google Groups "FriCAS - 
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/cc9badd4-f34c-442f-b130-105b418cc548%40hemmecke.org.

Reply via email to