[chuck-users] Bad return signature in pre-constructor leads to null instance

Kassen signal.automatique at gmail.com
Thu Mar 12 13:10:32 EDT 2009


Mike;

>
> FWIW, Java complains, however, C++ silently returns 0.0--or at least
> prints a 0.0.  I think that it matters less which solution ChucK uses
> than the idea that it's clear about it.  i.e. ChucK should complain,
> or avoid the error, but definitely not return a null object reference.
>

I agree; I'm leaning towards a runtime notice with the name of the function
listed if it goes wrong (in addition to either dropping the shred or
returning a new instance or zero value of whatever the type of the function)
and a compile time complaint if such a function doesn't contain the word
"return" at all.

That would allow nearly everything that currently runs to keep running, no
matter how dangerous the construction, yet provide notices if we made a
error.

I'm not in favour of ChucK baby-sitting me when I may be doing something
that ChucK thinks is dangerous even when I know it's fine in this context;
the parser may make less real errors than I do but I'm still convinced I'm
more clever than the parser is.

Kas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20090312/60af64f1/attachment.html>


More information about the chuck-users mailing list