discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

$slop special variable and threads

JB
Jordan Brown
Fri, Feb 24, 2023 10:22 PM

On 2/24/2023 2:00 PM, nop head wrote:

IIRC people used braces to allow code folding in the editor
without any other meaning, so making them introduce a new scope would
be a breaking change.

It is indeed theoretically a breaking change.

{
    x = 1;
}
echo(x);

is currently legal, and wouldn't be if braces introduced scopes.

I hadn't thought of the code-folding use.  But really, how many people
are going to use it for that and expect that a variable setting will
persist outside the block?

And note that the cost of the current behavior is non-zero.  We just had
a user confused by it and need to ask for help.

I don't know that I would ever get around to making this change, but if
somebody wanted to then I'd support it.  My tolerance for retaining
flaws in the interest of compatibility is limited.

On 2/24/2023 2:00 PM, nop head wrote: > IIRC people used braces to allow code folding in the editor > without any other meaning, so making them introduce a new scope would > be a breaking change. > It is indeed theoretically a breaking change. { x = 1; } echo(x); is currently legal, and wouldn't be if braces introduced scopes. I hadn't thought of the code-folding use.  But really, how many people are going to use it for that *and* expect that a variable setting will persist outside the block? And note that the cost of the current behavior is non-zero.  We just had a user confused by it and need to ask for help. I don't know that I would ever get around to making this change, but if somebody wanted to then I'd support it.  My tolerance for retaining flaws in the interest of compatibility is limited.