Re: [open-axiom-devel] [fricas-devel] Re: constants and overload resolution
A system for computer algebra and symbolic mathematics
Brought to you by:
dos-reis
From: Bill P. <bil...@ne...> - 2011-10-24 23:57:50
|
On Mon, Oct 24, 2011 at 7:36 PM, Gabriel Dos Reis wrote: > ... > Bill Page writes: > | So it is a coincidence that the compiler happens to choose 0@P or that > | the representation of all of these candidates is the same so that it > | does not matter? > > It is mostly concidence. The explanation is that the type of leftLcm is > > > (P,P) -> P > > and before starting the compilation of a function body, the compiler > automatically imports the return type and domain of each parameter. > So the modemap of 0@P happens to be first on the list, and since the > compilers the first that makes tentative compilation OK, it picks it and > moves on. > So here it seems very clear that one should have written: v:P := 0 and the use of v := 0 should produce an error message. I retrospect I think I have probably been bitten by this bug a few times in the past. One just seems to get used to working around such limitations. But this seems like an improvement to me even if it does affect a lot of existing code that happens to work right now. A sensible error message would be welcome. Would this be hard to do? Regards, Bill Page. |