discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

redefining members seems to make illegal objects - could use help with the diagnosis

V
vulcan_@mac.com
Mon, Jul 28, 2025 9:16 PM

this script

Fred = object( name="Fred", spouse="wilma", friends=["barney"] );

Wilma = object( name="Wilma", spouse=Fred, friends=["Betty"] );

Fred2 = object( Fred, friends=["barney",Wilma]);

echo(Fred2 =Fred2, "\n");

echo( fps = Fred2.spouse, "\n", Fred2.friends, "\n" );

ECHO: Fred2 = ["barney", { name = "Wilma"; spouse = { name = "Fred"; spouse = "wilma"; friends = { name = "Fred"; spouse = "wilma"; friends = ["barney"]; }; friends = ["Betty"]; }]; }

Fred2 is looking like a vector starting with “[“

expanding to show structure:

["barney",

{ name = "Wilma";

  spouse = { 

    name = "Fred"; 

    spouse = "wilma"; 

    friends = { 

      name = "Fred";

      spouse = "wilma";

      friends = \["barney"\];

      };

    friends = \["Betty"\];

    }

 \];

}

this looks wrong

is my script doing something wrong

this script `Fred = object( name="Fred", spouse="wilma", friends=["barney"] );` `Wilma = object( name="Wilma", spouse=Fred, friends=["Betty"] );` `Fred2 = object( Fred, friends=["barney",Wilma]);` `echo(Fred2 =Fred2, "\n");` `echo( fps = Fred2.spouse, "\n", Fred2.friends, "\n" );` ECHO: Fred2 = \["barney", { name = "Wilma"; spouse = { name = "Fred"; spouse = "wilma"; friends = { name = "Fred"; spouse = "wilma"; friends = \["barney"\]; }; friends = \["Betty"\]; }\]; } Fred2 is looking like a vector starting with “\[“ expanding to show structure: \["barney", { name = "Wilma"; spouse = { name = "Fred"; spouse = "wilma"; friends = { name = "Fred"; spouse = "wilma"; friends = \["barney"\]; }; friends = \["Betty"\]; } \]; } this looks wrong is my script doing something wrong
JB
Jordan Brown
Tue, Jul 29, 2025 1:16 AM

I'm pretty sure that the conversion to a string is somehow loused up.

Here's a pretty minimal demonstration.

Wilma = object(
    spouse=object()
);
echo( Wilma=Wilma);
 
Betty = object(
    friends=[Wilma]
);
echo( Betty  = Betty );

yields

ECHO: Wilma = { spouse = { }; }
ECHO: Betty = [{ spouse = { friends = { }; }]; }

It looks like the brackets from the friends member somehow end up in the
wrong places.

I'm pretty sure that the conversion to a string is somehow loused up. Here's a pretty minimal demonstration. Wilma = object(     spouse=object() ); echo( Wilma=Wilma);   Betty = object(     friends=[Wilma] ); echo( Betty  = Betty ); yields ECHO: Wilma = { spouse = { }; } ECHO: Betty = [{ spouse = { friends = { }; }]; } It looks like the brackets from the friends member somehow end up in the wrong places.
JB
Jordan Brown
Tue, Jul 29, 2025 5:44 AM

I've filed Bad output converting object to string #6048
https://github.com/openscad/openscad/issues/6048.

I've filed Bad output converting object to string #6048 <https://github.com/openscad/openscad/issues/6048>.
PK
Peter Kriens
Tue, Jul 29, 2025 7:28 AM

Interesting. The structure seems fine but the printing goes haywire. I expect that the array print function flushes and thereby races ahead of the object print out.

I'll verify and let you know. Thanks!

Peter

On 28 Jul 2025, at 23:16, vulcan_--- via Discuss discuss@lists.openscad.org wrote:

this script

Fred = object( name="Fred", spouse="wilma", friends=["barney"] );

Wilma = object( name="Wilma", spouse=Fred, friends=["Betty"] );

Fred2 = object( Fred, friends=["barney",Wilma]);

echo(Fred2 =Fred2, "\n");

echo( fps = Fred2.spouse, "\n", Fred2.friends, "\n" );

ECHO: Fred2 = ["barney", { name = "Wilma"; spouse = { name = "Fred"; spouse = "wilma"; friends = { name = "Fred"; spouse = "wilma"; friends = ["barney"]; }; friends = ["Betty"]; }]; }

Fred2 is looking like a vector starting with “[“

expanding to show structure:

["barney",

{ name = "Wilma";

spouse = {

name = "Fred";

spouse = "wilma";

friends = {

name = "Fred";

spouse = "wilma";

friends = ["barney"];

};

friends = ["Betty"];

}

];

}

this looks wrong

is my script doing something wrong


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Interesting. The structure seems fine but the printing goes haywire. I expect that the array print function flushes and thereby races ahead of the object print out. I'll verify and let you know. Thanks! Peter > On 28 Jul 2025, at 23:16, vulcan_--- via Discuss <discuss@lists.openscad.org> wrote: > > this script > > Fred = object( name="Fred", spouse="wilma", friends=["barney"] ); > > Wilma = object( name="Wilma", spouse=Fred, friends=["Betty"] ); > > Fred2 = object( Fred, friends=["barney",Wilma]); > > echo(Fred2 =Fred2, "\n"); > > echo( fps = Fred2.spouse, "\n", Fred2.friends, "\n" ); > > ECHO: Fred2 = ["barney", { name = "Wilma"; spouse = { name = "Fred"; spouse = "wilma"; friends = { name = "Fred"; spouse = "wilma"; friends = ["barney"]; }; friends = ["Betty"]; }]; } > > Fred2 is looking like a vector starting with “[“ > > expanding to show structure: > > ["barney", > > { name = "Wilma"; > > spouse = { > > name = "Fred"; > > spouse = "wilma"; > > friends = { > > name = "Fred"; > > spouse = "wilma"; > > friends = ["barney"]; > > }; > > friends = ["Betty"]; > > } > > ]; > > } > > this looks wrong > > is my script doing something wrong > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
V
vulcan_@mac.com
Wed, Jul 30, 2025 5:03 PM

Thanks Jordan

BTW .. i confirmed it is a printing problem by forming a vector of name=value pairs from my test object

it printed out correctly

Thanks Jordan BTW .. i confirmed it is a printing problem by forming a vector of name=value pairs from my test object it printed out correctly
PK
Peter Kriens
Wed, Jul 30, 2025 6:54 PM

I’ve created a PR #6051 that fixes this.

Was just an output issue.

On Wed 30 Jul 2025 at 19:04, vulcan_--- via Discuss <
discuss@lists.openscad.org> wrote:

Thanks Jordan

BTW .. i confirmed it is a printing problem by forming a vector of
name=value pairs from my test object

it printed out correctly


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I’ve created a PR #6051 that fixes this. Was just an output issue. On Wed 30 Jul 2025 at 19:04, vulcan_--- via Discuss < discuss@lists.openscad.org> wrote: > Thanks Jordan > > BTW .. i confirmed it is a printing problem by forming a vector of > name=value pairs from my test object > > it printed out correctly > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >