On 11/5/23 01:36, Waldek Hebisch wrote:
_Any_ attempt to read elements of uninitialized array may lead to troubles. So it is not only printing, but in general it is unsafe to pass uninitialized array to a routine, unless one _knows_ that the routine will initialize the array.
Yes, exactly that is the point. qnew claims to return an object of type %, but, in fact, it doesn't.
We could add the followowing to description of 'qnew': Use only when you know what you are doing.
That is one thing, but does not give enough information. How should a user know what he is doing? Where would he get this information from?
A better phrase would perhaps be: qnew constructs structure with uninitialized elements. Do not pass such a structure to other functions before its parts are initialized via setelt! or qsetelt!.
Possibly we could add a FAQ entry with some explanation.
Additionally also good, but I doubt that people jump to the FAQs if the stumple over problems with qnew.
I have doubts about general usefulness of NonNegativeInteger.
Indeed. There is no subtraction. Yes, that's not a total function in NNI, but in most use cases the programmer knows that the result is still in NNI. I sometimes wished there where a "minus: (NNI, NNI) -> NNI" that throws an error if the result becomes negative. But I do not care too much.
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/29c004a5-2565-45d7-a4d1-34b94c9d7592%40hemmecke.org.