discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

OpenSCAD2 design docs

DM
doug moen
Sun, Jul 5, 2015 2:08 AM

Hi Ben. Congratulations, you have managed to use my own words to completely
mischaracterize what my project is all about. Somehow, you managed to
ignore almost everything I wrote, quoted one sentence out of context, and
used it against me.

Also, I have to say that your vicious personal attacks against me go far
beyond anything I would have expected to read on the OpenSCAD forum. No, I
am not a psychopath. No, this project is not compensation for my small dick.

For everybody else, yes of course I understand that OpenSCAD is a
stateless, "functional" language, and that it is much easier to use than a
general purpose programming language. My design document actually states
both of these things as design goals.

On 3 July 2015 at 23:26, Ben Simons zuiopl@hotmail.com wrote:

At
you write :
"In short, although it wasn't a design goal, OpenSCAD2 appears to have all
of the necessary language mechanisms required to support object oriented
programming. This may turn out to be useful in the future for structuring
complex models or for writing new libraries of geometric objects."

==> It seems to me, taking an exising OO langugage and making a library
for it would free you of all the hassle with parsing? Plus you have all the
good parts of the language.
Please don't mimic a professor/CEO which thinks he needs a new language.

OpenSCAD2 is a backwards compatible redesign of OpenSCAD. Some
highlights:

- everything is a first class value, including functions, modules,
shapes, groups and scripts
- single unified namespace, instead of 3 namespaces for variables,
functions and modules
- modules are unified with functions
- the 'module composability bug' is fixed: 'intersection' now composes
with 'for'
- generic sequence operations and generalized list comprehensions
- objects: external script files are referenced as object values;
{script} is an object literal; 'object.name' looks up a named field in
an object
- groups are replaced by object values; the CSG tree is a tree of
objects
- the 'use' command is fixed: it can be used to reference any library

Design spec: https://github.com/doug-moen/openscad2

At this point, I'm looking for feedback and new collaborators. There may
ways to improve parts of the design to make it easier to use, or more
powerful, or less complex, or whatever. I expect that there are still bugs
in the backward compatibility provisions that may trigger design changes.

Since it's all on github, you may open issues if you like.

I don't have any working code yet. This has turned into a big project, so
that's going to take a while, and will be implemented in multiple stages. I
expect further design changes as a result of insights developed while
implementing all of this.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Hi Ben. Congratulations, you have managed to use my own words to completely mischaracterize what my project is all about. Somehow, you managed to ignore almost everything I wrote, quoted one sentence out of context, and used it against me. Also, I have to say that your vicious personal attacks against me go far beyond anything I would have expected to read on the OpenSCAD forum. No, I am not a psychopath. No, this project is not compensation for my small dick. For everybody else, yes of course I understand that OpenSCAD is a stateless, "functional" language, and that it is much easier to use than a general purpose programming language. My design document actually states both of these things as design goals. On 3 July 2015 at 23:26, Ben Simons <zuiopl@hotmail.com> wrote: > At > you write : > "In short, although it wasn't a design goal, OpenSCAD2 appears to have all > of the necessary language mechanisms required to support object oriented > programming. This may turn out to be useful in the future for structuring > complex models or for writing new libraries of geometric objects." > > ==> It seems to me, taking an exising OO langugage and making a library > for it would free you of all the hassle with parsing? Plus you have all the > good parts of the language. > Please don't mimic a professor/CEO which thinks he needs a new language. > > > OpenSCAD2 is a backwards compatible redesign of OpenSCAD. Some > highlights: > > - everything is a first class value, including functions, modules, > shapes, groups and scripts > - single unified namespace, instead of 3 namespaces for variables, > functions and modules > - modules are unified with functions > - the 'module composability bug' is fixed: 'intersection' now composes > with 'for' > - generic sequence operations and generalized list comprehensions > - objects: external script files are referenced as object values; > {script} is an object literal; 'object.name' looks up a named field in > an object > - groups are replaced by object values; the CSG tree is a tree of > objects > - the 'use' command is fixed: it can be used to reference any library > > Design spec: https://github.com/doug-moen/openscad2 > > At this point, I'm looking for feedback and new collaborators. There may > ways to improve parts of the design to make it easier to use, or more > powerful, or less complex, or whatever. I expect that there are still bugs > in the backward compatibility provisions that may trigger design changes. > > Since it's all on github, you may open issues if you like. > > I don't have any working code yet. This has turned into a big project, so > that's going to take a while, and will be implemented in multiple stages. I > expect further design changes as a result of insights developed while > implementing all of this. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
BS
Ben Simons
Sun, Jul 5, 2015 6:54 AM

Re: [OpenSCAD] OpenSCAD2 design docsWell, actually, I thought you are clever because you wanted to change it in the correct direction.
The three dots in the last option were for you and others here.
Ok, I don't say anything anymore.
My wording is bad...

Hi Ben. Congratulations, you have managed to use my own words to completely mischaracterize what my project is all about. Somehow, you managed to ignore almost everything I wrote, quoted one sentence out of context, and used it against me.

Also, I have to say that your vicious personal attacks against me go far beyond anything I would have expected to read on the OpenSCAD forum. No, I am not a psychopath. No, this project is not compensation for my small dick.

For everybody else, yes of course I understand that OpenSCAD is a stateless, "functional" language, and that it is much easier to use than a general purpose programming language. My design document actually states both of these things as design goals.

On 3 July 2015 at 23:26, Ben Simons <zuiopl@hotmail.com> wrote:
At
you write :
"In short, although it wasn't a design goal, OpenSCAD2 appears to have all of the necessary language mechanisms required to support object oriented programming. This may turn out to be useful in the future for structuring complex models or for writing new libraries of geometric objects."

==> It seems to me, taking an exising OO langugage and making a library for it would free you of all the hassle with parsing? Plus you have all the good parts of the language.
Please don't mimic a professor/CEO which thinks he needs a new language.

OpenSCAD2 is a backwards compatible redesign of OpenSCAD. Some highlights:

  • everything is a first class value, including functions, modules, shapes, groups and scripts
  • single unified namespace, instead of 3 namespaces for variables, functions and modules
  • modules are unified with functions
  • the 'module composability bug' is fixed: 'intersection' now composes with 'for'
  • generic sequence operations and generalized list comprehensions
  • objects: external script files are referenced as object values; {script} is an object literal; 'object.name' looks up a named field in an object
  • groups are replaced by object values; the CSG tree is a tree of objects
  • the 'use' command is fixed: it can be used to reference any library

Design spec: https://github.com/doug-moen/openscad2

At this point, I'm looking for feedback and new collaborators. There may ways to improve parts of the design to make it easier to use, or more powerful, or less complex, or whatever. I expect that there are still bugs in the backward compatibility provisions that may trigger design changes.

Since it's all on github, you may open issues if you like.

I don't have any working code yet. This has turned into a big project, so that's going to take a while, and will be implemented in multiple stages. I expect further design changes as a result of insights developed while implementing all of this.

_______________________________________________
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

LB
L Boyd
Sun, Jul 5, 2015 1:43 PM

Using a general purpose language is great in the academic world, but not the
efficient way to address a specific problem. I have spent some 50 years
creating specific solutions where the general purpose solution was much
slower, sometime by a factor of 100.

Keep up your good work and don't let the C/C+ freaks distract you.

--
View this message in context: http://forum.openscad.org/OpenSCAD2-design-docs-tp13019p13043.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Using a general purpose language is great in the academic world, but not the efficient way to address a specific problem. I have spent some 50 years creating specific solutions where the general purpose solution was much slower, sometime by a factor of 100. Keep up your good work and don't let the C/C+ freaks distract you. -- View this message in context: http://forum.openscad.org/OpenSCAD2-design-docs-tp13019p13043.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Sun, Jul 5, 2015 2:09 PM

L Boyd wrote

some 50 years creating specific solutions

...if you count Tandy TRS-80 fiddling in the store, with BASIC and
cassettes, then I can count 40 odd years...I wrote a pretty good shoot-em-up
game...

Not as good as my DEC VT100 based space game I did at Uni...Shame you never
get credits for that stuff back then...

So I'm assuming I'm a bit wiser than I feel older... ;)


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/OpenSCAD2-design-docs-tp13019p13045.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

L Boyd wrote > some 50 years creating specific solutions ...if you count Tandy TRS-80 fiddling in the store, with BASIC and cassettes, then I can count 40 odd years...I wrote a pretty good shoot-em-up game... Not as good as my DEC VT100 based space game I did at Uni...Shame you never get credits for that stuff back then... So I'm assuming I'm a bit wiser than I feel older... ;) ----- 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/OpenSCAD2-design-docs-tp13019p13045.html Sent from the OpenSCAD mailing list archive at Nabble.com.
LB
L Boyd
Mon, Jul 6, 2015 12:02 PM

I know what you mean about not getting credit for what you did way back then.
No one remembers that I was the first one outside of Dartmouth to write a
BASIC compiler. It was a one pass compiler for the SDS 940 which fit in 2K
(24 bit) words of read only memory. When IBM later wrote their version, it
used over 100K words.

--
View this message in context: http://forum.openscad.org/OpenSCAD2-design-docs-tp13019p13067.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I know what you mean about not getting credit for what you did way back then. No one remembers that I was the first one outside of Dartmouth to write a BASIC compiler. It was a one pass compiler for the SDS 940 which fit in 2K (24 bit) words of read only memory. When IBM later wrote their version, it used over 100K words. -- View this message in context: http://forum.openscad.org/OpenSCAD2-design-docs-tp13019p13067.html Sent from the OpenSCAD mailing list archive at Nabble.com.
JD
Jerry Davis
Thu, Jul 16, 2015 11:29 AM

I was wondering. I do that occasionally :-)

if a use("v2") statement was at the top of the file. Could a lot of the
extra functions be the same name as the old ones, but with the different
args needed? Or is that too much work?

jerry

Jerry

--
Extra Ham Operator: K7AZJ
Registered Linux User: 275424
Raspberry Pi and Arduino developer

The most exciting phrase to hear in science - the one that heralds new
discoveries - is not "Eureka!" but "That's funny...".
- Isaac. Asimov

I
*f you give someone a program, you will frustrate them for a day; if you
teach them how to program, you will frustrate them for a lifetime. *-
Anonymous

If writing good code requires very little comments, then writing really
excellent code requires no comments at all!
- Ken Thompson

On Mon, Jul 6, 2015 at 7:02 AM, L Boyd lboyd@frontiernet.net wrote:

I know what you mean about not getting credit for what you did way back
then.
No one remembers that I was the first one outside of Dartmouth to write a
BASIC compiler. It was a one pass compiler for the SDS 940 which fit in 2K
(24 bit) words of read only memory. When IBM later wrote their version, it
used over 100K words.

--
View this message in context:
http://forum.openscad.org/OpenSCAD2-design-docs-tp13019p13067.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

I was wondering. I do that occasionally :-) if a use("v2") statement was at the top of the file. Could a lot of the extra functions be the same name as the old ones, but with the different args needed? Or is that too much work? jerry Jerry -- Extra Ham Operator: K7AZJ Registered Linux User: 275424 Raspberry Pi and Arduino developer *The most exciting phrase to hear in science - the one that heralds new discoveries - is not "Eureka!" but "That's funny...".*- Isaac. Asimov *I* *f you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime. *- Anonymous *If writing good code requires very little comments, then writing really excellent code requires no comments at all!*- Ken Thompson On Mon, Jul 6, 2015 at 7:02 AM, L Boyd <lboyd@frontiernet.net> wrote: > I know what you mean about not getting credit for what you did way back > then. > No one remembers that I was the first one outside of Dartmouth to write a > BASIC compiler. It was a one pass compiler for the SDS 940 which fit in 2K > (24 bit) words of read only memory. When IBM later wrote their version, it > used over 100K words. > > > > -- > View this message in context: > http://forum.openscad.org/OpenSCAD2-design-docs-tp13019p13067.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 >
M
MichaelAtOz
Sat, Jul 18, 2015 5:10 AM

Re scope rules for v2.

I have used this layout

{ // rECESS - the hollow holder where accessories are inserted
rTolerance=0.0; // adjust - originally the ID of the print was marginally
tight 2.05 2.75
rOD=40;
rID=35.5;
rThick=2-rTolerance;
rDeep=38; // was 45
}

{ // rECESS Ridge - the raised ridges running down inside the holder
rRidgeHigh=0.75-rTolerance;
rRidgeWide=3;
rRidgeWide0=6.2; // at mid-line parallel with slot at top
rRidgeNum=6; // spacing, includes the one cut away by wide slot
}

To group the definitions but mainly to allow me to collapse them in the
editor.

I think I have seen other code in the wild doing so too.

Is that going to be problematic in v2 scoping?


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/OpenSCAD2-design-docs-tp13019p13225.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Re scope rules for v2. I have used this layout { // rECESS - the hollow holder where accessories are inserted rTolerance=0.0; // adjust - originally the ID of the print was marginally tight 2.05 2.75 rOD=40; rID=35.5; rThick=2-rTolerance; rDeep=38; // was 45 } { // rECESS Ridge - the raised ridges running down inside the holder rRidgeHigh=0.75-rTolerance; rRidgeWide=3; rRidgeWide0=6.2; // at mid-line parallel with slot at top rRidgeNum=6; // spacing, includes the one cut away by wide slot } To group the definitions but mainly to allow me to collapse them in the editor. I think I have seen other code in the wild doing so too. Is that going to be problematic in v2 scoping? ----- 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/OpenSCAD2-design-docs-tp13019p13225.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Sat, Jul 18, 2015 5:19 AM

Note in the email the line breaks were removed.


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/OpenSCAD2-design-docs-tp13019p13226.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Note in the email the line breaks were removed. ----- 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/OpenSCAD2-design-docs-tp13019p13226.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
runsun
Sat, Jul 18, 2015 5:03 PM

Doug (in other thread) wrote

In OpenSCAD2, the syntax {...} is an expression that returns a geometric
object.
For example, { size=10; cube(size); } is an expression.

You can give this expression a name:

mycube = {
   size=10;
   cube(size);
};

Now 'mycube' is the name of a geometric object.

echo(mycube.size); // ECHO: 10

rotate(45) mycube;

Doug.

  1. I'd prefer that this geometric object has some built-in parameters, for
    example, like points:

    echo( mycube.points );

    So we can do these:

    1.1) translate( mycube.points[3]) yourcube;

    1.2) for( p= mycube.points ) translate( p ) sphere(...);

    1.3)  for( i= mycube.points[4:] )        // pick up the second half
    mycube.points[i]= somefunc(i); // re-assign points to
    change shape

    1.4) Assuming we have a Line() module, draw a line to connect two
    objects (at specified points):

         Line( mycube.points[0], yourcube.points[2] )
    

    1.5) distance( mycube.points[0], yourcube.points[2] )

  2. I'd prefer all those actions, like translate, rotate, union, etc, can be*
    functions*, too:

    yourcube = rotate( mycube, 45 );
    hiscube = translate( yourcube.points[2] );
    

All the ideas have one thing in mind: *keeping track of coordinates for
further operations. *


$  Runsun Pan, PhD

$ -- OpenScad_DocTest ( Thingiverse ), faces , Offliner

$ -- hash parameter model: here , here

$ -- Linux Mint 17.1 Rebecca x64  + OpenSCAD 2015.03.15/2015.04.01.nightly

--
View this message in context: http://forum.openscad.org/OpenSCAD2-design-docs-tp13019p13232.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Doug (in other thread) wrote > > In OpenSCAD2, the syntax {...} is an expression that returns a geometric > object. > For example, { size=10; cube(size); } is an expression. > > You can give this expression a name: > > mycube = { > size=10; > cube(size); > }; > > Now 'mycube' is the name of a geometric object. > > echo(mycube.size); // ECHO: 10 > > rotate(45) mycube; > > Doug. 1) I'd prefer that this geometric object has some *built-in parameters*, for example, like *points*: echo( mycube.points ); So we can do these: 1.1) translate( mycube.points[3]) yourcube; 1.2) for( p= mycube.points ) translate( p ) sphere(...); 1.3) for( i= mycube.points[4:] ) // pick up the second half mycube.points[i]= somefunc(i); // re-assign points to change shape 1.4) Assuming we have a Line() module, draw a line to connect two objects (at specified points): Line( mycube.points[0], yourcube.points[2] ) 1.5) distance( mycube.points[0], yourcube.points[2] ) 2) I'd prefer all those actions, like translate, rotate, union, etc, can be* functions*, too: yourcube = rotate( mycube, 45 ); hiscube = translate( yourcube.points[2] ); All the ideas have one thing in mind: *keeping track of coordinates for further operations. * ----- $ Runsun Pan, PhD $ -- OpenScad_DocTest ( Thingiverse ), faces , Offliner $ -- hash parameter model: here , here $ -- Linux Mint 17.1 Rebecca x64 + OpenSCAD 2015.03.15/2015.04.01.nightly -- View this message in context: http://forum.openscad.org/OpenSCAD2-design-docs-tp13019p13232.html Sent from the OpenSCAD mailing list archive at Nabble.com.
DM
doug moen
Sat, Jul 18, 2015 6:01 PM

MichaelAtOz notes that a top level compound statement, {...}, is
interpreted by OpenSCAD as if the braces aren't there. Michael uses this to
group sets of related definitions within a large script, so that they can
be collapsed by the folding tree editor.

This is new information for me: I didn't know that people are using this
design pattern "in the wild", as Michael says.

Right now, the idiomatic way to write this code in OpenSCAD2 is:

include { // rECESS - the hollow holder where accessories are inserted
rTolerance=0.0; // adjust - originally the ID of the print was marginally
tight 2.05 2.75
rOD=40;
rID=35.5;
rThick=2-rTolerance;
rDeep=38;              // was 45
};

include { // rECESS Ridge - the raised ridges running down inside the holder
rRidgeHigh=0.75-rTolerance;
rRidgeWide=3;
rRidgeWide0=6.2;        // at mid-line parallel with slot at top
rRidgeNum=6;    // spacing, includes the one cut away by wide slot
};

Explanation: the OpenSCAD2 'include' operator takes an object expression as
an argument, and {...} is an object literal.

Also, in OpenSCAD2, objects are the replacement for groups in the CSG tree.
Each non-leaf node in the CSG tree is an object. As a result, "top level
compound statements" could appear naturally in code as a representation of
nested objects in a CSG tree. And that conflicts with the current use of
that syntax that Michael reports.

At present, this is an incompatibility between the existing language and
OpenSCAD2 that I wasn't aware of.

The new OpenSCAD implementation will use heuristics to detect OpenSCAD1
code and run in backward compatibility mode. It should be capable of
detecting Michael's code and evaluating it correctly without breaking.
There will also be an upgrade tool that converts existing code to use the
new syntax, and we could convert top level {...} statements to 'include
{...};' as part of the upgrade.

Michael, do you think this is an acceptable solution to the problem that
you uncovered?

Doug.

On 18 July 2015 at 01:10, MichaelAtOz oz.at.michael@gmail.com wrote:

Re scope rules for v2.

I have used this layout

{ // rECESS - the hollow holder where accessories are inserted
rTolerance=0.0; // adjust - originally the ID of the print was marginally
tight 2.05 2.75
rOD=40;
rID=35.5;
rThick=2-rTolerance;
rDeep=38;              // was 45
}

{ // rECESS Ridge - the raised ridges running down inside the holder
rRidgeHigh=0.75-rTolerance;
rRidgeWide=3;
rRidgeWide0=6.2;        // at mid-line parallel with slot at top
rRidgeNum=6;    // spacing, includes the one cut away by wide slot
}

To group the definitions but mainly to allow me to collapse them in the
editor.

I think I have seen other code in the wild doing so too.

Is that going to be problematic in v2 scoping?


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/OpenSCAD2-design-docs-tp13019p13225.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

MichaelAtOz notes that a top level compound statement, {...}, is interpreted by OpenSCAD as if the braces aren't there. Michael uses this to group sets of related definitions within a large script, so that they can be collapsed by the folding tree editor. This is new information for me: I didn't know that people are using this design pattern "in the wild", as Michael says. Right now, the idiomatic way to write this code in OpenSCAD2 is: include { // rECESS - the hollow holder where accessories are inserted rTolerance=0.0; // adjust - originally the ID of the print was marginally tight 2.05 2.75 rOD=40; rID=35.5; rThick=2-rTolerance; rDeep=38; // was 45 }; include { // rECESS Ridge - the raised ridges running down inside the holder rRidgeHigh=0.75-rTolerance; rRidgeWide=3; rRidgeWide0=6.2; // at mid-line parallel with slot at top rRidgeNum=6; // spacing, includes the one cut away by wide slot }; Explanation: the OpenSCAD2 'include' operator takes an object expression as an argument, and {...} is an object literal. Also, in OpenSCAD2, objects are the replacement for groups in the CSG tree. Each non-leaf node in the CSG tree is an object. As a result, "top level compound statements" could appear naturally in code as a representation of nested objects in a CSG tree. And that conflicts with the current use of that syntax that Michael reports. At present, this is an incompatibility between the existing language and OpenSCAD2 that I wasn't aware of. The new OpenSCAD implementation will use heuristics to detect OpenSCAD1 code and run in backward compatibility mode. It should be capable of detecting Michael's code and evaluating it correctly without breaking. There will also be an upgrade tool that converts existing code to use the new syntax, and we could convert top level {...} statements to 'include {...};' as part of the upgrade. Michael, do you think this is an acceptable solution to the problem that you uncovered? Doug. On 18 July 2015 at 01:10, MichaelAtOz <oz.at.michael@gmail.com> wrote: > Re scope rules for v2. > > I have used this layout > > > { // rECESS - the hollow holder where accessories are inserted > rTolerance=0.0; // adjust - originally the ID of the print was marginally > tight 2.05 2.75 > rOD=40; > rID=35.5; > rThick=2-rTolerance; > rDeep=38; // was 45 > } > > { // rECESS Ridge - the raised ridges running down inside the holder > rRidgeHigh=0.75-rTolerance; > rRidgeWide=3; > rRidgeWide0=6.2; // at mid-line parallel with slot at top > rRidgeNum=6; // spacing, includes the one cut away by wide slot > } > > To group the definitions but mainly to allow me to collapse them in the > editor. > > I think I have seen other code in the wild doing so too. > > Is that going to be problematic in v2 scoping? > > > > > ----- > 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/OpenSCAD2-design-docs-tp13019p13225.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 >