discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Unaccountable warning

RP
Ronaldo Persiano
Fri, May 10, 2019 6:08 PM

Running:

function foo() =
[for( i = 0;
i < 1;
assert(i<1),
i = i+1 ) i];

echo(foo());

I got:

Compiling design (CSG Tree generation)...

WARNING: Assignment without variable name undef, in file
OpenSCAD-2019.01-RC4, line 2

ECHO: [0]

Line 2 is the line of the "for". Without the assert(), no message is
issued.

Running: function foo() = [for( i = 0; i < 1; assert(i<1), i = i+1 ) i]; echo(foo()); I got: Compiling design (CSG Tree generation)... WARNING: Assignment without variable name undef, in file OpenSCAD-2019.01-RC4, line 2 ECHO: [0] Line 2 is the line of the "for". Without the assert(), no message is issued.
TP
Torsten Paul
Fri, May 10, 2019 6:56 PM

On 10.05.19 20:08, Ronaldo Persiano wrote:

Line 2 is the line of the "for". Without the assert(), > no message is issued.

The message is correct. It's caused by the "," after the assert().

Moving the assert into the assignment of i it should work without
warning.

 function foo() =
   [for( i = 0;
         i < 1;
         i = assert(i<1) i+1 ) i];

ciao,
Torsten.

On 10.05.19 20:08, Ronaldo Persiano wrote: > Line 2 is the line of the "for". Without the assert(), > no message is issued. The message is correct. It's caused by the "," after the assert(). Moving the assert into the assignment of i it should work without warning. function foo() = [for( i = 0; i < 1; i = assert(i<1) i+1 ) i]; ciao, Torsten.
RP
Ronaldo Persiano
Fri, May 10, 2019 7:57 PM

The message is correct. It's caused by the "," after the assert().

Moving the assert into the assignment of i it should work without
warning.

  function foo() =
    [for( i = 0;
          i < 1;
          i = assert(i<1) i+1 ) i];

But, the following works without any warning:

function foo2() =
let( i = 0,
assert(i<1),
j = 1 )
j;

What that warning means?

The message is correct. It's caused by the "," after the assert(). > > Moving the assert into the assignment of i it should work without > warning. > > function foo() = > [for( i = 0; > i < 1; > i = assert(i<1) i+1 ) i]; > But, the following works without any warning: function foo2() = let( i = 0, assert(i<1), j = 1 ) j; What that warning means?
TP
Torsten Paul
Fri, May 10, 2019 8:08 PM

On 10.05.19 21:57, Ronaldo Persiano wrote:

What that warning means?

I guess that just means that the warning check is missing
in let().

In both cases the parser generates an assignment list:

lvalue1 = rvalue1, lvalue2 = rvalue2

The warning means that one of the lvalues does not have
a name. The parser allows that currently as it's reusing
the structure used for method calls where a missing
lvalue simply means it's a positional parameter like in
cube([1, 2, 3], center = true);

ciao,
Torsten.

On 10.05.19 21:57, Ronaldo Persiano wrote: > What that warning means? I guess that just means that the warning check is missing in let(). In both cases the parser generates an assignment list: lvalue1 = rvalue1, lvalue2 = rvalue2 The warning means that one of the lvalues does not have a name. The parser allows that currently as it's reusing the structure used for method calls where a missing lvalue simply means it's a positional parameter like in cube([1, 2, 3], center = true); ciao, Torsten.