AM
Adrian Mariano
Sat, Jan 22, 2022 2:30 PM
Is there a way to check the OpenSCAD version and abort with a message
if it is too old to run the file? I tried this:
assert(version()[0]>=2019, "OpenSCAD version too old");
a=2^4;
But this fails with a parser error if the version is too old, rather
than displaying the message.
Is there a way to check the OpenSCAD version and abort with a message
if it is too old to run the file? I tried this:
assert(version()[0]>=2019, "OpenSCAD version too old");
a=2^4;
But this fails with a parser error if the version is too old, rather
than displaying the message.
J
jon
Sat, Jan 22, 2022 2:36 PM
It certainly would be helpful if code that requires a recent snapshot
(something past the current release) could be flagged so that the user
saw an informative message if they attempted to run with an older compiler.
Unfortunately, it would be difficult to write a compiler that recognized
a feature newer than the compiler's release date, and emitted a
message. But that would be nice! <grin>
On 1/22/2022 9:30 AM, Adrian Mariano wrote:
Is there a way to check the OpenSCAD version and abort with a message
if it is too old to run the file? I tried this:
assert(version()[0]>=2019, "OpenSCAD version too old");
a=2^4;
But this fails with a parser error if the version is too old, rather
than displaying the message.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
It certainly would be helpful if code that requires a recent snapshot
(something past the current release) could be flagged so that the user
saw an informative message if they attempted to run with an older compiler.
Unfortunately, it would be difficult to write a compiler that recognized
a feature newer than the compiler's release date, and emitted a
message. But that would be nice! <grin>
On 1/22/2022 9:30 AM, Adrian Mariano wrote:
> Is there a way to check the OpenSCAD version and abort with a message
> if it is too old to run the file? I tried this:
>
> assert(version()[0]>=2019, "OpenSCAD version too old");
> a=2^4;
>
> But this fails with a parser error if the version is too old, rather
> than displaying the message.
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
NH
nop head
Sat, Jan 22, 2022 3:12 PM
What error message do you see? I think it has always been valid syntax but
assert might be an undefined module or version an undefined function.
On Sat, 22 Jan 2022 at 14:36, jon jon@jonbondy.com wrote:
It certainly would be helpful if code that requires a recent snapshot
(something past the current release) could be flagged so that the user
saw an informative message if they attempted to run with an older compiler.
Unfortunately, it would be difficult to write a compiler that recognized
a feature newer than the compiler's release date, and emitted a
message. But that would be nice! <grin>
On 1/22/2022 9:30 AM, Adrian Mariano wrote:
Is there a way to check the OpenSCAD version and abort with a message
if it is too old to run the file? I tried this:
assert(version()[0]>=2019, "OpenSCAD version too old");
a=2^4;
But this fails with a parser error if the version is too old, rather
than displaying the message.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
What error message do you see? I think it has always been valid syntax but
assert might be an undefined module or version an undefined function.
On Sat, 22 Jan 2022 at 14:36, jon <jon@jonbondy.com> wrote:
> It certainly would be helpful if code that requires a recent snapshot
> (something past the current release) could be flagged so that the user
> saw an informative message if they attempted to run with an older compiler.
>
> Unfortunately, it would be difficult to write a compiler that recognized
> a feature newer than the compiler's release date, and emitted a
> message. But that would be nice! <grin>
>
>
> On 1/22/2022 9:30 AM, Adrian Mariano wrote:
> > Is there a way to check the OpenSCAD version and abort with a message
> > if it is too old to run the file? I tried this:
> >
> > assert(version()[0]>=2019, "OpenSCAD version too old");
> > a=2^4;
> >
> > But this fails with a parser error if the version is too old, rather
> > than displaying the message.
> > _______________________________________________
> > OpenSCAD mailing list
> > To unsubscribe send an email to discuss-leave@lists.openscad.org
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>
AM
Adrian Mariano
Sat, Jan 22, 2022 3:20 PM
I'm not asking for the compiler to magically recognize code from
future versions. I'm asking for a way to say "this code requires
version 2019.1 or newer" that actually works when the subsequent code
is not valid. This actually seems like it ought to be pretty easy to
implement. It's up to the author of the code to know what version is
needed and insert the requirement.
In answer to nophead:
dummy=assert(version()[0]>=2021);
a=2^3;
when run under 2019.5 gives the message:
ERROR: Parser error in file "/home/adrian/scad/test30.scad", line 2:
syntax error
because the '^' is not recognized. This is not such an old version
that assert() wasn't supported. If I change it to:
dummy=assert(version()[0]>=2021);
a=pow(2,3);
and run in 2019.5 then I get:
ERROR: Assertion '(version()[0] >= 2021)' failed in file test30.scad, line 1
Obviously the issue is that OpenSCAD parses the file before it runs
it, so it gets the parse error before it runs the assert.
On Sat, Jan 22, 2022 at 9:36 AM jon jon@jonbondy.com wrote:
It certainly would be helpful if code that requires a recent snapshot
(something past the current release) could be flagged so that the user
saw an informative message if they attempted to run with an older compiler.
Unfortunately, it would be difficult to write a compiler that recognized
a feature newer than the compiler's release date, and emitted a
message. But that would be nice! <grin>
On 1/22/2022 9:30 AM, Adrian Mariano wrote:
Is there a way to check the OpenSCAD version and abort with a message
if it is too old to run the file? I tried this:
assert(version()[0]>=2019, "OpenSCAD version too old");
a=2^4;
But this fails with a parser error if the version is too old, rather
than displaying the message.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
I'm not asking for the compiler to magically recognize code from
future versions. I'm asking for a way to say "this code requires
version 2019.1 or newer" that actually works when the subsequent code
is not valid. This actually seems like it ought to be pretty easy to
implement. It's up to the author of the code to know what version is
needed and insert the requirement.
In answer to nophead:
dummy=assert(version()[0]>=2021);
a=2^3;
when run under 2019.5 gives the message:
ERROR: Parser error in file "/home/adrian/scad/test30.scad", line 2:
syntax error
because the '^' is not recognized. This is not such an old version
that assert() wasn't supported. If I change it to:
dummy=assert(version()[0]>=2021);
a=pow(2,3);
and run in 2019.5 then I get:
ERROR: Assertion '(version()[0] >= 2021)' failed in file test30.scad, line 1
Obviously the issue is that OpenSCAD parses the file before it runs
it, so it gets the parse error before it runs the assert.
On Sat, Jan 22, 2022 at 9:36 AM jon <jon@jonbondy.com> wrote:
>
> It certainly would be helpful if code that requires a recent snapshot
> (something past the current release) could be flagged so that the user
> saw an informative message if they attempted to run with an older compiler.
>
> Unfortunately, it would be difficult to write a compiler that recognized
> a feature newer than the compiler's release date, and emitted a
> message. But that would be nice! <grin>
>
>
> On 1/22/2022 9:30 AM, Adrian Mariano wrote:
> > Is there a way to check the OpenSCAD version and abort with a message
> > if it is too old to run the file? I tried this:
> >
> > assert(version()[0]>=2019, "OpenSCAD version too old");
> > a=2^4;
> >
> > But this fails with a parser error if the version is too old, rather
> > than displaying the message.
> > _______________________________________________
> > OpenSCAD mailing list
> > To unsubscribe send an email to discuss-leave@lists.openscad.org
CM
Curt McDowell
Sun, Jan 23, 2022 10:20 AM
I agree because recently I something I posted on Thingiverse failed on
someone and it confused them (their version didn't have function literals).
Maybe there could be an optional version comment that gets checked
before parsing (there's already precedent for interpreting comments
since the Customizer does it, albeit that's after parsing).
// version [2021.01 : ]
Cheers,
Curt
On 1/22/2022 6:30 AM, Adrian Mariano wrote:
Is there a way to check the OpenSCAD version and abort with a message
if it is too old to run the file? I tried this:
assert(version()[0]>=2019, "OpenSCAD version too old");
a=2^4;
But this fails with a parser error if the version is too old, rather
than displaying the message.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
I agree because recently I something I posted on Thingiverse failed on
someone and it confused them (their version didn't have function literals).
Maybe there could be an optional version comment that gets checked
before parsing (there's already precedent for interpreting comments
since the Customizer does it, albeit that's after parsing).
// version [2021.01 : ]
Cheers,
Curt
On 1/22/2022 6:30 AM, Adrian Mariano wrote:
> Is there a way to check the OpenSCAD version and abort with a message
> if it is too old to run the file? I tried this:
>
> assert(version()[0]>=2019, "OpenSCAD version too old");
> a=2^4;
>
> But this fails with a parser error if the version is too old, rather
> than displaying the message.
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
NH
nop head
Sun, Jan 23, 2022 11:13 AM
Yes but any change needs to be in a new version, so how will that help
people with old versions?
On Sun, 23 Jan 2022 at 10:21, Curt McDowell maker@fishlet.com wrote:
I agree because recently I something I posted on Thingiverse failed on
someone and it confused them (their version didn't have function literals).
Maybe there could be an optional version comment that gets checked
before parsing (there's already precedent for interpreting comments
since the Customizer does it, albeit that's after parsing).
// version [2021.01 : ]
Cheers,
Curt
On 1/22/2022 6:30 AM, Adrian Mariano wrote:
Is there a way to check the OpenSCAD version and abort with a message
if it is too old to run the file? I tried this:
assert(version()[0]>=2019, "OpenSCAD version too old");
a=2^4;
But this fails with a parser error if the version is too old, rather
than displaying the message.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Yes but any change needs to be in a new version, so how will that help
people with old versions?
On Sun, 23 Jan 2022 at 10:21, Curt McDowell <maker@fishlet.com> wrote:
> I agree because recently I something I posted on Thingiverse failed on
> someone and it confused them (their version didn't have function literals).
>
> Maybe there could be an optional version comment that gets checked
> before parsing (there's already precedent for interpreting comments
> since the Customizer does it, albeit that's after parsing).
>
> // version [2021.01 : ]
>
> Cheers,
> Curt
>
> On 1/22/2022 6:30 AM, Adrian Mariano wrote:
> > Is there a way to check the OpenSCAD version and abort with a message
> > if it is too old to run the file? I tried this:
> >
> > assert(version()[0]>=2019, "OpenSCAD version too old");
> > a=2^4;
> >
> > But this fails with a parser error if the version is too old, rather
> > than displaying the message.
> > _______________________________________________
> > OpenSCAD mailing list
> > To unsubscribe send an email to discuss-leave@lists.openscad.org
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>
CM
Curt McDowell
Sun, Jan 23, 2022 11:22 AM
They can't be helped, but presumably the majority of users are in the
future.
On 1/23/2022 3:13 AM, nop head wrote:
Yes but any change needs to be in a new version, so how will that help
people with old versions?
They can't be helped, but presumably the majority of users are in the
future.
On 1/23/2022 3:13 AM, nop head wrote:
> Yes but any change needs to be in a new version, so how will that help
> people with old versions?
BC
Bob Carter
Sun, Jan 23, 2022 2:37 PM
I think you may be able to bodge around it using the existence or not of any special variables that came into existence with a specific release e.g.
$preview came in with 2019.05
$vpf came in with 2021.01
newer = is_undef($vpf);
assert (!newer, "Need newer Level of OpenSCAD”);
cheers
Bob.C
On 23 Jan 2022, at 11:22, Curt McDowell maker@fishlet.com wrote:
They can't be helped, but presumably the majority of users are in the future.
On 1/23/2022 3:13 AM, nop head wrote:
Yes but any change needs to be in a new version, so how will that help people with old versions?
I think you may be able to bodge around it using the existence or not of any special variables that came into existence with a specific release e.g.
$preview came in with 2019.05
$vpf came in with 2021.01
newer = is_undef($vpf);
assert (!newer, "Need newer Level of OpenSCAD”);
cheers
Bob.C
> On 23 Jan 2022, at 11:22, Curt McDowell <maker@fishlet.com> wrote:
>
> They can't be helped, but presumably the majority of users are in the future.
>
> On 1/23/2022 3:13 AM, nop head wrote:
>> Yes but any change needs to be in a new version, so how will that help people with old versions?
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
AM
Adrian Mariano
Sun, Jan 23, 2022 2:46 PM
OpenSCAD has a version() function that returns the version. The
problem is not figuring out if the version is OK. The problem is that
if it's not, you get a syntax error before any assert() statements
run, so it doesn't do any good.
On Sun, Jan 23, 2022 at 9:38 AM Bob Carter caggius@gmail.com wrote:
I think you may be able to bodge around it using the existence or not of any special variables that came into existence with a specific release e.g.
$preview came in with 2019.05
$vpf came in with 2021.01
newer = is_undef($vpf);
assert (!newer, "Need newer Level of OpenSCAD”);
cheers
Bob.C
On 23 Jan 2022, at 11:22, Curt McDowell maker@fishlet.com wrote:
They can't be helped, but presumably the majority of users are in the future.
On 1/23/2022 3:13 AM, nop head wrote:
Yes but any change needs to be in a new version, so how will that help people with old versions?
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD has a version() function that returns the version. The
problem is not figuring out if the version is OK. The problem is that
if it's not, you get a syntax error before any assert() statements
run, so it doesn't do any good.
On Sun, Jan 23, 2022 at 9:38 AM Bob Carter <caggius@gmail.com> wrote:
>
> I think you may be able to bodge around it using the existence or not of any special variables that came into existence with a specific release e.g.
>
> $preview came in with 2019.05
> $vpf came in with 2021.01
>
> newer = is_undef($vpf);
> assert (!newer, "Need newer Level of OpenSCAD”);
>
> cheers
> Bob.C
>
>
> > On 23 Jan 2022, at 11:22, Curt McDowell <maker@fishlet.com> wrote:
> >
> > They can't be helped, but presumably the majority of users are in the future.
> >
> > On 1/23/2022 3:13 AM, nop head wrote:
> >> Yes but any change needs to be in a new version, so how will that help people with old versions?
> > _______________________________________________
> > OpenSCAD mailing list
> > To unsubscribe send an email to discuss-leave@lists.openscad.org
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
RW
Rogier Wolff
Sun, Jan 23, 2022 5:00 PM
On Sun, Jan 23, 2022 at 11:13:06AM +0000, nop head wrote:
Yes but any change needs to be in a new version, so how will that help
people with old versions?
You can recommend:
// This checks for openscad version 2022.2 or later
check_version (2022, 2);
If that errors out with a line number on older versions, people will
at least be pointed to the right line number about why the file
doesn't work.
I spent a day and a half debugging "module xyz not found" messages in
a python program. Turns out the program was not compatible with
python-2. Something I installed depended on python-2 so the python-2
install script decided: You installed me last, so I get to claim
/usr/bin/python.
An error message: "This program requires python-3" would've been nice
to point me in the right direction. Even an error message:
syntax error on the line 123:
122: // we need a reasonably recent python
123: python version needs to be at least 3.5
124:
would have been nice. Even if python-2 errors on that line.
Roger.
I agree because recently I something I posted on Thingiverse failed on
someone and it confused them (their version didn't have function literals).
Maybe there could be an optional version comment that gets checked
before parsing (there's already precedent for interpreting comments
since the Customizer does it, albeit that's after parsing).
// version [2021.01 : ]
Cheers,
Curt
On 1/22/2022 6:30 AM, Adrian Mariano wrote:
Is there a way to check the OpenSCAD version and abort with a message
if it is too old to run the file? I tried this:
assert(version()[0]>=2019, "OpenSCAD version too old");
a=2^4;
But this fails with a parser error if the version is too old, rather
than displaying the message.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 **
f equals m times a. When your f is steady, and your m is going down
your a is going up. -- Chris Hadfield about flying up the space shuttle.
On Sun, Jan 23, 2022 at 11:13:06AM +0000, nop head wrote:
> Yes but any change needs to be in a new version, so how will that help
> people with old versions?
You can recommend:
// This checks for openscad version 2022.2 or later
check_version (2022, 2);
If that errors out with a line number on older versions, people will
at least be pointed to the right line number about why the file
doesn't work.
I spent a day and a half debugging "module xyz not found" messages in
a python program. Turns out the program was not compatible with
python-2. Something I installed depended on python-2 so the python-2
install script decided: You installed me last, so I get to claim
/usr/bin/python.
An error message: "This program requires python-3" would've been nice
to point me in the right direction. Even an error message:
syntax error on the line 123:
122: // we need a reasonably recent python
123: python version needs to be at least 3.5
124:
would have been nice. Even if python-2 errors on that line.
Roger.
> On Sun, 23 Jan 2022 at 10:21, Curt McDowell <maker@fishlet.com> wrote:
>
> > I agree because recently I something I posted on Thingiverse failed on
> > someone and it confused them (their version didn't have function literals).
> >
> > Maybe there could be an optional version comment that gets checked
> > before parsing (there's already precedent for interpreting comments
> > since the Customizer does it, albeit that's after parsing).
> >
> > // version [2021.01 : ]
> >
> > Cheers,
> > Curt
> >
> > On 1/22/2022 6:30 AM, Adrian Mariano wrote:
> > > Is there a way to check the OpenSCAD version and abort with a message
> > > if it is too old to run the file? I tried this:
> > >
> > > assert(version()[0]>=2019, "OpenSCAD version too old");
> > > a=2^4;
> > >
> > > But this fails with a parser error if the version is too old, rather
> > > than displaying the message.
> > > _______________________________________________
> > > OpenSCAD mailing list
> > > To unsubscribe send an email to discuss-leave@lists.openscad.org
> > _______________________________________________
> > OpenSCAD mailing list
> > To unsubscribe send an email to discuss-leave@lists.openscad.org
> >
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 **
f equals m times a. When your f is steady, and your m is going down
your a is going up. -- Chris Hadfield about flying up the space shuttle.