Is there any way to say "if these parameters are bad, quit immediately"?
Jon
Von: jon jon@jonbondy.com
Is there any way to say "if these parameters are bad, quit immediately"?
Currently there is no such thing (except implementing it manually using flags).
There is a request to add something like assert() in:
https://github.com/openscad/openscad/issues/381
which is a bit awkward to implement as it would be useful to handle both
functions and modules.
ciao,
Torsten.
I had an issue like this in a Customizer script where users could choose
values that could make a nonsense result. Because of the lack of a feedback
or reporting loop, I chose to detect the conditoin and replace the generated
object with a text object containing a message.
So I executed normally but exposed a different object.
--
View this message in context: http://forum.openscad.org/Quit-or-Exit-function-tp13659p13669.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Yeh, but it would be handy to have something deep in your code like
exit("you idiot!");
Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Quit-or-Exit-function-tp13659p13672.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
tp3 wrote
which is a bit awkward to implement as it would be useful to handle both
functions and modules.
Add an option to my theoretical echof()
https://github.com/openscad/openscad/issues/741 - who's name can be just
echo() but proposed within functions. And echo() the module too of course.
echo("You idiot!", $exit=true);
// $exit, to try to reduce backward compatibility conflict with normal
variable names.
Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Quit-or-Exit-function-tp13659p13673.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
On Mon, 31 Aug 2015 20:32:19 -0700 (MST)
MichaelAtOz oz.at.michael@gmail.com wrote:
tp3 wrote
which is a bit awkward to implement as it would be useful to handle
both functions and modules.
Add an option to my theoretical echof()
https://github.com/openscad/openscad/issues/741 - who's name can
be just echo() but proposed within functions. And echo() the module
too of course.
echo("You idiot!", $exit=true);
// $exit, to try to reduce backward compatibility conflict with normal
variable names.
I would prefer an exit() function, or, if we want a message a different
function like die() or fatal().
I really don't like functions/methods/subroutines with flag parameters.
G. Wade
Unless specifically shown otherwise above, my contribution is in the
Public Domain; To the extent possible under law, I have waived all
copyright and related or neighbouring rights to this work. This work
is published globally via the internet. :) Inclusion of works of
previous authors is not included in the above.
The TPP is no simple “trade agreement.” Fight it!
http://www.ourfairdeal.org/ --
View this message in context:
http://forum.openscad.org/Quit-or-Exit-function-tp13659p13673.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
--
Always hold a grudge. Keeps the memory sharp. -- Hagar the Horrible
G. Wade Johnson wrote
I would prefer an exit() function, or, if we want a message a different
function like die() or fatal().
I really don't like functions/methods/subroutines with flag parameters.
True, I was trying an extra push for echof() ;) ...
Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Quit-or-Exit-function-tp13659p13677.html
Sent from the OpenSCAD mailing list archive at Nabble.com.