On Thu, Apr 20, 2023 at 12:02:59PM +0200, Ralf Hemmecke wrote:
> Dear Waldek,
>
> This is about a misleading error message.
>
> When I compile my code with this function
>
> initialize(m: List F): % ==
> t: F := first m
> per [initialize(t)$AB, sort(smallerGrade?, rest m), empty()]
>
> the compiler spits out the stuff at the end of the mail.
> In particular it it marks the error to this.
>
> (|construct| | << | ((|Sel| AB |initialize|) |t|) | >> |
>
> That came to me as a surprise, because the changes to the previous version
> did not involve anything connected to iniitalize, but rather were a renaming
> of smallerGrade? to less?.
>
> Now I see that the compiler gave a warning:
>
> [4] initialize: smallerGrade? has no value
>
> which should not be a warning, but is the actual cause of the error.
Well, "has no value" means that Spad compiler did not see assignment
or initialization of variable. In this specific case it means error
but in general variable may have value assigned and Spad compiler
may miss this. So the message can only be warning. For example,
during algebra build Spad compiler emits 7931 such messages.
Algebra may contain errors, but vast majority of such cases is OK.
> I should also have renamed smallerGrade? to less? in the function cited
> above.
>
> Is it worth it that I make a small example program that you can compile and
> that demonstrates the above proplem?
AFAICS you gave enough info to reproduce the problem.
> Or do we just leave the situation as
> is? I think, it's a bug, but I have no immediate incentive to invest time in
> it, since the compiler messages are anyway usually pretty hard to decipher.
I would not call this "bug". You example is an easy one, but
there are fundamental limitations what Spad-like compiler can
do in such cases. I wonder what Aldor reports for such code?
--
Waldek Hebisch