That doesn't work. If you do
require_version(2022,1);
a=3^4;
and run in version 2019.5 it gives a syntax error on line 2---that is,
the error occurs where the new syntax is used, not on the statement
about the version. If I run this in 2021.1 then I get "unknown
module" on line 1. In order to make this idea really work the new
version requirement statement needs to be a parser error in old
versions.
On Sun, Jan 23, 2022 at 12:00 PM Rogier Wolff R.E.Wolff@bitwizard.nl wrote:
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.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
That doesn't work. If you do
require_version(2022,1);
a=3^4;
and run in version 2019.5 it gives a syntax error on line 2---that is,
the error occurs where the new syntax is used, not on the statement
about the version. If I run this in 2021.1 then I get "unknown
module" on line 1. In order to make this idea really work the new
version requirement statement needs to be a parser error in old
versions.
On Sun, Jan 23, 2022 at 12:00 PM Rogier Wolff <R.E.Wolff@bitwizard.nl> wrote:
>
> 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.
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org