discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: Style questions

JB
Jordan Brown
Fri, Aug 19, 2022 5:13 PM

On 8/19/2022 6:11 AM, Roger Whiteley via Discuss wrote:

For me, clarity, intent and readability are far more important than
saving a line here or there,

Absolutely.

white space literally gives me space to think..

Whitespace should separate conceptual blocks / steps / et cetera. 
Putting the open brace on a separate line chews up whitespace and
separates two things (the control statement and the controlled block)
that are tied together.  They are already separated by indentation;
additional separation does not normally seem appropriate.

I indent and newline children, whether inbuilt children or modules.

All of them?  Even, say, a translate() rotate() scale() sequence?  So
you would do

translate(...)
    rotate(...)
        scale(...)
            something(...);

Two letter variables are reserved for, well reserved meaning - e.g.
differencing two objects which have one or more matching dimensions
causes lots of compute time to resolve the overlaps, so I assign a
consistent variable which always represents a small delta in axis
direction or dimension, and for 3d printing, a simple pa - for print
allowance - to increase the size of holes to compensate for undersized
holes.

Yes.  Similarly for one-letter variables.

On 8/19/2022 6:11 AM, Roger Whiteley via Discuss wrote: > For me, clarity, intent and readability are far more important than > saving a line here or there, Absolutely. > white space literally gives me space to think.. Whitespace should separate conceptual blocks / steps / et cetera.  Putting the open brace on a separate line chews up whitespace and separates two things (the control statement and the controlled block) that are tied together.  They are *already* separated by indentation; additional separation does not normally seem appropriate. > I indent and newline children, whether inbuilt children or modules. All of them?  Even, say, a translate() rotate() scale() sequence?  So you would do translate(...) rotate(...) scale(...) something(...); > Two letter variables are reserved for, well reserved meaning - e.g. > differencing two objects which have one or more matching dimensions > causes lots of compute time to resolve the overlaps, so I assign a > consistent variable which always represents a small delta in axis > direction or dimension, and for 3d printing, a simple pa - for print > allowance - to increase the size of holes to compensate for undersized > holes. Yes.  Similarly for one-letter variables.