discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Why a semicolon right after module definition line not a syntax error

I
Ivo
Sun, Apr 1, 2018 7:58 AM

MichaelAtOz wrote

runsun wrote

I still think that a statement like "module m();" should be an error.  It
seems to serve no purpose other than confusing users.

module null(); is quite useful.

module null() {};

would do the same and not break syntax.

Cheers, Ivo

--
Sent from: http://forum.openscad.org/

MichaelAtOz wrote > runsun wrote >> I still think that a statement like "module m();" should be an error. It >> seems to serve no purpose other than confusing users. > > module null(); is quite useful. module null() {}; would do the same and not break syntax. Cheers, Ivo -- Sent from: http://forum.openscad.org/
I
Ivo
Sun, Apr 1, 2018 8:01 AM

runsun wrote

MichaelAtOz wrote

module null(); is quite useful.

Example usage ?

I use

module empty() {};

To be able to pass empty children to other functions.

--
Sent from: http://forum.openscad.org/

runsun wrote > MichaelAtOz wrote >> module null(); is quite useful. > > Example usage ? I use module empty() {}; To be able to pass empty children to other functions. -- Sent from: http://forum.openscad.org/
T
Troberg
Tue, Apr 3, 2018 9:02 AM

...until you copy code from emails or web pages where

the indentation gets lost and result in a mess. I did
have those cases from time to time and that is massively
annoying too.

Or when you write a code generator. When piecing together snippets of code,
it's much easier if you don't have to bother about how deeply indented it
needs to be, and instead just makes a second pass based on control
structures such as braces (or whatever is used in the language you are
generating) to fix indentation.

It would be nice to have warnings for those cases.

I agree, this is a warning issue, not an error. With the current lack of
meaningful error messages, I'd say that this one is a low priority.

--
Sent from: http://forum.openscad.org/

> ...until you copy code from emails or web pages where the indentation gets lost and result in a mess. I did have those cases from time to time and that is massively annoying too. Or when you write a code generator. When piecing together snippets of code, it's much easier if you don't have to bother about how deeply indented it needs to be, and instead just makes a second pass based on control structures such as braces (or whatever is used in the language you are generating) to fix indentation. > It would be nice to have warnings for those cases. I agree, this is a warning issue, not an error. With the current lack of meaningful error messages, I'd say that this one is a low priority. -- Sent from: http://forum.openscad.org/