discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

redefining module without errors

JB
Jon Bondy
Fri, Jun 7, 2024 11:43 PM

The following code does not generate any warnings or errors.  It this
correct behavior?  Using version 2024.01.14 (git 158c5b94f)

Jon

module Pot()
    cube(10);

module Pot()
    cube(20);

Pot();

--
This email has been checked for viruses by AVG antivirus software.
www.avg.com

The following code does not generate any warnings or errors.  It this correct behavior?  Using version 2024.01.14 (git 158c5b94f) Jon module Pot()     cube(10); module Pot()     cube(20); Pot(); -- This email has been checked for viruses by AVG antivirus software. www.avg.com
FH
Father Horton
Sat, Jun 8, 2024 12:57 AM

When it comes to variables, the last definition in the scope applies. I
think the same thing applies here.

On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss <
discuss@lists.openscad.org> wrote:

The following code does not generate any warnings or errors.  It this
correct behavior?  Using version 2024.01.14 (git 158c5b94f)

Jon

module Pot()
cube(10);

module Pot()
cube(20);

Pot();

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
Virus-free.www.avg.com
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
<#m_5027073627314722081_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


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

When it comes to variables, the last definition in the scope applies. I think the same thing applies here. On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss < discuss@lists.openscad.org> wrote: > The following code does not generate any warnings or errors. It this > correct behavior? Using version 2024.01.14 (git 158c5b94f) > > Jon > > > > > > module Pot() > cube(10); > > module Pot() > cube(20); > > Pot(); > > > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > Virus-free.www.avg.com > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > <#m_5027073627314722081_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jon Bondy
Sat, Jun 8, 2024 1:45 AM

At least I get a warning when I re-define a variable!

On 6/7/2024 8:57 PM, Father Horton via Discuss wrote:

When it comes to variables, the last definition in the scope applies.
I think the same thing applies here.

On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss
discuss@lists.openscad.org wrote:

 The following code does not generate any warnings or errors.  It
 this correct behavior?  Using version 2024.01.14 (git 158c5b94f)

 Jon





 module Pot()
     cube(10);

 module Pot()
     cube(20);

 Pot();


 <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
 	Virus-free.www.avg.com
 <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>


 <#m_5027073627314722081_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email to discuss-leave@lists.openscad.org

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

--
This email has been checked for viruses by AVG antivirus software.
www.avg.com

At least I get a warning when I re-define a variable! On 6/7/2024 8:57 PM, Father Horton via Discuss wrote: > When it comes to variables, the last definition in the scope applies. > I think the same thing applies here. > > On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss > <discuss@lists.openscad.org> wrote: > > The following code does not generate any warnings or errors.  It > this correct behavior?  Using version 2024.01.14 (git 158c5b94f) > > Jon > > > > > > module Pot() >     cube(10); > > module Pot() >     cube(20); > > Pot(); > > > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > Virus-free.www.avg.com > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > > > <#m_5027073627314722081_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org -- This email has been checked for viruses by AVG antivirus software. www.avg.com
LM
Leonard Martin Struttmann
Sat, Jun 8, 2024 3:32 AM

Jon, yes this is correct.  This allows you to override modules (even
OpenSCAD primitives) with your own, enhanced versions.  The BOSL2 library
does this a lot. It can be confusing at times, but it is very powerful.

On Fri, Jun 7, 2024 at 7:58 PM Father Horton via Discuss <
discuss@lists.openscad.org> wrote:

When it comes to variables, the last definition in the scope applies. I
think the same thing applies here.

On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss <
discuss@lists.openscad.org> wrote:

The following code does not generate any warnings or errors.  It this
correct behavior?  Using version 2024.01.14 (git 158c5b94f)

Jon

module Pot()
cube(10);

module Pot()
cube(20);

Pot();

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
Virus-free.www.avg.com
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
<#m_1614698544112551610_m_5027073627314722081_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


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


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

Jon, yes this is correct. This allows you to override modules (even OpenSCAD primitives) with your own, enhanced versions. The BOSL2 library does this a lot. It can be confusing at times, but it is very powerful. On Fri, Jun 7, 2024 at 7:58 PM Father Horton via Discuss < discuss@lists.openscad.org> wrote: > When it comes to variables, the last definition in the scope applies. I > think the same thing applies here. > > On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss < > discuss@lists.openscad.org> wrote: > >> The following code does not generate any warnings or errors. It this >> correct behavior? Using version 2024.01.14 (git 158c5b94f) >> >> Jon >> >> >> >> >> >> module Pot() >> cube(10); >> >> module Pot() >> cube(20); >> >> Pot(); >> >> >> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >> Virus-free.www.avg.com >> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >> <#m_1614698544112551610_m_5027073627314722081_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jon Bondy
Sat, Jun 8, 2024 10:42 AM

I claim this is a serious bug.  I can't tell you how much time I spent
altering a module and seeing nothing change.  I imagine it is way too
late to change, but it would be helpful if there were SOME utility that
allowed one to know that such an over-ride has occurred, ESPECIALLY 
within a single text file.  I cannot see any use for re-defining a
module within a file: that surely would deserve a warning.

Sigh.

On 6/7/2024 11:32 PM, Leonard Martin Struttmann via Discuss wrote:

Jon, yes this is correct.  This allows you to override modules (even
OpenSCAD primitives) with your own, enhanced versions. The
BOSL2 library does this a lot. It can be confusing at times, but it is
very powerful.

On Fri, Jun 7, 2024 at 7:58 PM Father Horton via Discuss
discuss@lists.openscad.org wrote:

 When it comes to variables, the last definition in the scope
 applies. I think the same thing applies here.

 On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss
 <discuss@lists.openscad.org> wrote:

     The following code does not generate any warnings or errors. 
     It this correct behavior?  Using version 2024.01.14 (git
     158c5b94f)

     Jon





     module Pot()
         cube(10);

     module Pot()
         cube(20);

     Pot();


     <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
     	Virus-free.www.avg.com
     <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>


     <#m_1614698544112551610_m_5027073627314722081_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
     _______________________________________________
     OpenSCAD mailing list
     To unsubscribe send an email to discuss-leave@lists.openscad.org

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

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

--
This email has been checked for viruses by AVG antivirus software.
www.avg.com

I claim this is a serious bug.  I can't tell you how much time I spent altering a module and seeing nothing change.  I imagine it is way too late to change, but it would be helpful if there were SOME utility that allowed one to know that such an over-ride has occurred, ESPECIALLY  within a single text file.  I cannot see any use for re-defining a module within a file: that surely would deserve a warning. Sigh. On 6/7/2024 11:32 PM, Leonard Martin Struttmann via Discuss wrote: > Jon, yes this is correct.  This allows you to override modules (even > OpenSCAD primitives) with your own, enhanced versions. The > BOSL2 library does this a lot. It can be confusing at times, but it is > very powerful. > > On Fri, Jun 7, 2024 at 7:58 PM Father Horton via Discuss > <discuss@lists.openscad.org> wrote: > > When it comes to variables, the last definition in the scope > applies. I think the same thing applies here. > > On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss > <discuss@lists.openscad.org> wrote: > > The following code does not generate any warnings or errors.  > It this correct behavior?  Using version 2024.01.14 (git > 158c5b94f) > > Jon > > > > > > module Pot() >     cube(10); > > module Pot() >     cube(20); > > Pot(); > > > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > Virus-free.www.avg.com > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > > > <#m_1614698544112551610_m_5027073627314722081_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org -- This email has been checked for viruses by AVG antivirus software. www.avg.com
MM
Michael Möller
Sat, Jun 8, 2024 11:06 AM

Well, trying to be constructive here, it might be implemented as a extended
warningmode, off by default. I'm thinking like "lint" in C, a nitpicking
mode.

Unfortunatly that means a syntax extensions or compiler hints (typically a
specially formatted comment fex /!/) that signals this redefenition is
intentional.

If the people who use their spare time to implement such extended warnings
feel this is worthwhile, they could also consider flagging unused variables
and suchlike.

lør. 8. jun. 2024 12.43 skrev Jon Bondy via Discuss <
discuss@lists.openscad.org>:

I claim this is a serious bug.  I can't tell you how much time I spent
altering a module and seeing nothing change.  I imagine it is way too late
to change, but it would be helpful if there were SOME utility that allowed
one to know that such an over-ride has occurred, ESPECIALLY  within a
single text file.  I cannot see any use for re-defining a module within a
file: that surely would deserve a warning.

Sigh.
On 6/7/2024 11:32 PM, Leonard Martin Struttmann via Discuss wrote:

Jon, yes this is correct.  This allows you to override modules (even
OpenSCAD primitives) with your own, enhanced versions.  The BOSL2 library
does this a lot. It can be confusing at times, but it is very powerful.

On Fri, Jun 7, 2024 at 7:58 PM Father Horton via Discuss <
discuss@lists.openscad.org> wrote:

When it comes to variables, the last definition in the scope applies. I
think the same thing applies here.

On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss <
discuss@lists.openscad.org> wrote:

The following code does not generate any warnings or errors.  It this
correct behavior?  Using version 2024.01.14 (git 158c5b94f)

Jon

module Pot()
cube(10);

module Pot()
cube(20);

Pot();

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
Virus-free.www.avg.com
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
<#m_6900578273720796704_m_2926902926704344873_m_-2905878328472071567_m_1614698544112551610_m_5027073627314722081_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


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


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


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


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

Well, trying to be constructive here, it might be implemented as a extended warningmode, off by default. I'm thinking like "lint" in C, a nitpicking mode. Unfortunatly that means a syntax extensions or compiler hints (typically a specially formatted comment fex /*!*/) that signals this redefenition is intentional. If the people who use their spare time to implement such extended warnings feel this is worthwhile, they could also consider flagging unused variables and suchlike. M² lør. 8. jun. 2024 12.43 skrev Jon Bondy via Discuss < discuss@lists.openscad.org>: > I claim this is a serious bug. I can't tell you how much time I spent > altering a module and seeing nothing change. I imagine it is way too late > to change, but it would be helpful if there were SOME utility that allowed > one to know that such an over-ride has occurred, ESPECIALLY within a > single text file. I cannot see any use for re-defining a module within a > file: that surely would deserve a warning. > > Sigh. > On 6/7/2024 11:32 PM, Leonard Martin Struttmann via Discuss wrote: > > Jon, yes this is correct. This allows you to override modules (even > OpenSCAD primitives) with your own, enhanced versions. The BOSL2 library > does this a lot. It can be confusing at times, but it is very powerful. > > On Fri, Jun 7, 2024 at 7:58 PM Father Horton via Discuss < > discuss@lists.openscad.org> wrote: > >> When it comes to variables, the last definition in the scope applies. I >> think the same thing applies here. >> >> On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss < >> discuss@lists.openscad.org> wrote: >> >>> The following code does not generate any warnings or errors. It this >>> correct behavior? Using version 2024.01.14 (git 158c5b94f) >>> >>> Jon >>> >>> >>> >>> >>> >>> module Pot() >>> cube(10); >>> >>> module Pot() >>> cube(20); >>> >>> Pot(); >>> >>> >>> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >>> Virus-free.www.avg.com >>> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >>> <#m_6900578273720796704_m_2926902926704344873_m_-2905878328472071567_m_1614698544112551610_m_5027073627314722081_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
LM
Leonard Martin Struttmann
Sat, Jun 8, 2024 11:34 AM

I, personally, would want this extended warning mode to be ON by default.
I, too, have spent many hours tracking down why strange things were
happening in my code only to discover that a library that I was using had a
module with the same name as I had.

However, this "feature" can be quite useful.  BOSL2 overrides primitives
such as cube() and cylinder() that work exactly like the OpenSCAD
primitives, while allowing one to position and orient the created shape.

On Sat, Jun 8, 2024 at 6:06 AM Michael Möller via Discuss <
discuss@lists.openscad.org> wrote:

Well, trying to be constructive here, it might be implemented as a
extended warningmode, off by default. I'm thinking like "lint" in C, a
nitpicking mode.

Unfortunatly that means a syntax extensions or compiler hints (typically a
specially formatted comment fex /!/) that signals this redefenition is
intentional.

If the people who use their spare time to implement such extended warnings
feel this is worthwhile, they could also consider flagging unused variables
and suchlike.

lør. 8. jun. 2024 12.43 skrev Jon Bondy via Discuss <
discuss@lists.openscad.org>:

I claim this is a serious bug.  I can't tell you how much time I spent
altering a module and seeing nothing change.  I imagine it is way too late
to change, but it would be helpful if there were SOME utility that allowed
one to know that such an over-ride has occurred, ESPECIALLY  within a
single text file.  I cannot see any use for re-defining a module within a
file: that surely would deserve a warning.

Sigh.
On 6/7/2024 11:32 PM, Leonard Martin Struttmann via Discuss wrote:

Jon, yes this is correct.  This allows you to override modules (even
OpenSCAD primitives) with your own, enhanced versions.  The BOSL2 library
does this a lot. It can be confusing at times, but it is very powerful.

On Fri, Jun 7, 2024 at 7:58 PM Father Horton via Discuss <
discuss@lists.openscad.org> wrote:

When it comes to variables, the last definition in the scope applies. I
think the same thing applies here.

On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss <
discuss@lists.openscad.org> wrote:

The following code does not generate any warnings or errors.  It this
correct behavior?  Using version 2024.01.14 (git 158c5b94f)

Jon

module Pot()
cube(10);

module Pot()
cube(20);

Pot();

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
Virus-free.www.avg.com
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
<#m_-1805384075366004004_m_6900578273720796704_m_2926902926704344873_m_-2905878328472071567_m_1614698544112551610_m_5027073627314722081_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


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


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


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


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


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

I, personally, would want this extended warning mode to be ON by default. I, too, have spent many hours tracking down why strange things were happening in my code only to discover that a library that I was using had a module with the same name as I had. However, this "feature" can be quite useful. BOSL2 overrides primitives such as cube() and cylinder() that work exactly like the OpenSCAD primitives, while allowing one to position and orient the created shape. On Sat, Jun 8, 2024 at 6:06 AM Michael Möller via Discuss < discuss@lists.openscad.org> wrote: > Well, trying to be constructive here, it might be implemented as a > extended warningmode, off by default. I'm thinking like "lint" in C, a > nitpicking mode. > > Unfortunatly that means a syntax extensions or compiler hints (typically a > specially formatted comment fex /*!*/) that signals this redefenition is > intentional. > > If the people who use their spare time to implement such extended warnings > feel this is worthwhile, they could also consider flagging unused variables > and suchlike. > > M² > > lør. 8. jun. 2024 12.43 skrev Jon Bondy via Discuss < > discuss@lists.openscad.org>: > >> I claim this is a serious bug. I can't tell you how much time I spent >> altering a module and seeing nothing change. I imagine it is way too late >> to change, but it would be helpful if there were SOME utility that allowed >> one to know that such an over-ride has occurred, ESPECIALLY within a >> single text file. I cannot see any use for re-defining a module within a >> file: that surely would deserve a warning. >> >> Sigh. >> On 6/7/2024 11:32 PM, Leonard Martin Struttmann via Discuss wrote: >> >> Jon, yes this is correct. This allows you to override modules (even >> OpenSCAD primitives) with your own, enhanced versions. The BOSL2 library >> does this a lot. It can be confusing at times, but it is very powerful. >> >> On Fri, Jun 7, 2024 at 7:58 PM Father Horton via Discuss < >> discuss@lists.openscad.org> wrote: >> >>> When it comes to variables, the last definition in the scope applies. I >>> think the same thing applies here. >>> >>> On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss < >>> discuss@lists.openscad.org> wrote: >>> >>>> The following code does not generate any warnings or errors. It this >>>> correct behavior? Using version 2024.01.14 (git 158c5b94f) >>>> >>>> Jon >>>> >>>> >>>> >>>> >>>> >>>> module Pot() >>>> cube(10); >>>> >>>> module Pot() >>>> cube(20); >>>> >>>> Pot(); >>>> >>>> >>>> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >>>> Virus-free.www.avg.com >>>> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >>>> <#m_-1805384075366004004_m_6900578273720796704_m_2926902926704344873_m_-2905878328472071567_m_1614698544112551610_m_5027073627314722081_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jon Bondy
Sat, Jun 8, 2024 11:43 AM

I agree that it is both useful (when used appropriately) and troublesome
(when used accidentally).  The trick is trying to detect the latter
without destroying the former.

On 6/8/2024 7:34 AM, Leonard Martin Struttmann via Discuss wrote:

I, personally, would want this extended warning mode to be ON by
default.  I, too, have spent many hours tracking down why strange
things were happening in my code only to discover that a library that
I was using had a module with the same name as I had.

However, this "feature" can be quite useful.  BOSL2 overrides
primitives such as cube() and cylinder() that work exactly like the
OpenSCAD primitives, while allowing one to position and orient the
created shape.

On Sat, Jun 8, 2024 at 6:06 AM Michael Möller via Discuss
discuss@lists.openscad.org wrote:

 Well, trying to be constructive here, it might be implemented as a
 extended warningmode, off by default. I'm thinking like "lint" in
 C, a nitpicking mode.

 Unfortunatly that means a syntax extensions or compiler hints
 (typically a specially formatted comment fex /*!*/) that signals
 this redefenition is intentional.

 If the people who use their spare time to implement such extended
 warnings feel this is worthwhile, they could also consider
 flagging unused variables and suchlike.

 M²

 lør. 8. jun. 2024 12.43 skrev Jon Bondy via Discuss
 <discuss@lists.openscad.org>:

     I claim this is a serious bug.  I can't tell you how much time
     I spent altering a module and seeing nothing change.  I
     imagine it is way too late to change, but it would be helpful
     if there were SOME utility that allowed one to know that such
     an over-ride has occurred, ESPECIALLY  within a single text
     file.  I cannot see any use for re-defining a module within a
     file: that surely would deserve a warning.

     Sigh.

     On 6/7/2024 11:32 PM, Leonard Martin Struttmann via Discuss wrote:
     Jon, yes this is correct.  This allows you to override
     modules (even OpenSCAD primitives) with your own, enhanced
     versions.  The BOSL2 library does this a lot. It can be
     confusing at times, but it is very powerful.

     On Fri, Jun 7, 2024 at 7:58 PM Father Horton via Discuss
     <discuss@lists.openscad.org> wrote:

         When it comes to variables, the last definition in the
         scope applies. I think the same thing applies here.

         On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss
         <discuss@lists.openscad.org> wrote:

             The following code does not generate any warnings or
             errors.  It this correct behavior?  Using version
             2024.01.14 (git 158c5b94f)

             Jon





             module Pot()
                 cube(10);

             module Pot()
                 cube(20);

             Pot();


             <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
             	Virus-free.www.avg.com
             <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>


             <#m_-1805384075366004004_m_6900578273720796704_m_2926902926704344873_m_-2905878328472071567_m_1614698544112551610_m_5027073627314722081_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
             _______________________________________________
             OpenSCAD mailing list
             To unsubscribe send an email to
             discuss-leave@lists.openscad.org

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


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

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

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

--
This email has been checked for viruses by AVG antivirus software.
www.avg.com

I agree that it is both useful (when used appropriately) and troublesome (when used accidentally).  The trick is trying to detect the latter without destroying the former. On 6/8/2024 7:34 AM, Leonard Martin Struttmann via Discuss wrote: > I, personally, would want this extended warning mode to be ON by > default.  I, too, have spent many hours tracking down why strange > things were happening in my code only to discover that a library that > I was using had a module with the same name as I had. > > However, this "feature" can be quite useful.  BOSL2 overrides > primitives such as cube() and cylinder() that work exactly like the > OpenSCAD primitives, while allowing one to position and orient the > created shape. > > On Sat, Jun 8, 2024 at 6:06 AM Michael Möller via Discuss > <discuss@lists.openscad.org> wrote: > > Well, trying to be constructive here, it might be implemented as a > extended warningmode, off by default. I'm thinking like "lint" in > C, a nitpicking mode. > > Unfortunatly that means a syntax extensions or compiler hints > (typically a specially formatted comment fex /*!*/) that signals > this redefenition is intentional. > > If the people who use their spare time to implement such extended > warnings feel this is worthwhile, they could also consider > flagging unused variables and suchlike. > > M² > > lør. 8. jun. 2024 12.43 skrev Jon Bondy via Discuss > <discuss@lists.openscad.org>: > > I claim this is a serious bug.  I can't tell you how much time > I spent altering a module and seeing nothing change.  I > imagine it is way too late to change, but it would be helpful > if there were SOME utility that allowed one to know that such > an over-ride has occurred, ESPECIALLY  within a single text > file.  I cannot see any use for re-defining a module within a > file: that surely would deserve a warning. > > Sigh. > > On 6/7/2024 11:32 PM, Leonard Martin Struttmann via Discuss wrote: >> Jon, yes this is correct.  This allows you to override >> modules (even OpenSCAD primitives) with your own, enhanced >> versions.  The BOSL2 library does this a lot. It can be >> confusing at times, but it is very powerful. >> >> On Fri, Jun 7, 2024 at 7:58 PM Father Horton via Discuss >> <discuss@lists.openscad.org> wrote: >> >> When it comes to variables, the last definition in the >> scope applies. I think the same thing applies here. >> >> On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss >> <discuss@lists.openscad.org> wrote: >> >> The following code does not generate any warnings or >> errors.  It this correct behavior?  Using version >> 2024.01.14 (git 158c5b94f) >> >> Jon >> >> >> >> >> >> module Pot() >>     cube(10); >> >> module Pot() >>     cube(20); >> >> Pot(); >> >> >> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >> Virus-free.www.avg.com >> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >> >> >> <#m_-1805384075366004004_m_6900578273720796704_m_2926902926704344873_m_-2905878328472071567_m_1614698544112551610_m_5027073627314722081_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to >> discuss-leave@lists.openscad.org >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to >> discuss-leave@lists.openscad.org >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email todiscuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org -- This email has been checked for viruses by AVG antivirus software. www.avg.com
AM
Adrian Mariano
Sat, Jun 8, 2024 12:39 PM

It wouldn't be hard to devise a syntax for redefining modules to
distinguish from modules that are not being redefined.  One could imagine
"module foo" vs "replace module foo" for example.

On Sat, Jun 8, 2024 at 7:44 AM Jon Bondy via Discuss <
discuss@lists.openscad.org> wrote:

I agree that it is both useful (when used appropriately) and troublesome
(when used accidentally).  The trick is trying to detect the latter without
destroying the former.
On 6/8/2024 7:34 AM, Leonard Martin Struttmann via Discuss wrote:

I, personally, would want this extended warning mode to be ON by default.
I, too, have spent many hours tracking down why strange things were
happening in my code only to discover that a library that I was using had a
module with the same name as I had.

However, this "feature" can be quite useful.  BOSL2 overrides primitives
such as cube() and cylinder() that work exactly like the OpenSCAD
primitives, while allowing one to position and orient the created shape.

On Sat, Jun 8, 2024 at 6:06 AM Michael Möller via Discuss <
discuss@lists.openscad.org> wrote:

Well, trying to be constructive here, it might be implemented as a
extended warningmode, off by default. I'm thinking like "lint" in C, a
nitpicking mode.

Unfortunatly that means a syntax extensions or compiler hints (typically
a specially formatted comment fex /!/) that signals this redefenition is
intentional.

If the people who use their spare time to implement such extended
warnings feel this is worthwhile, they could also consider flagging unused
variables and suchlike.

lør. 8. jun. 2024 12.43 skrev Jon Bondy via Discuss <
discuss@lists.openscad.org>:

I claim this is a serious bug.  I can't tell you how much time I spent
altering a module and seeing nothing change.  I imagine it is way too late
to change, but it would be helpful if there were SOME utility that allowed
one to know that such an over-ride has occurred, ESPECIALLY  within a
single text file.  I cannot see any use for re-defining a module within a
file: that surely would deserve a warning.

Sigh.
On 6/7/2024 11:32 PM, Leonard Martin Struttmann via Discuss wrote:

Jon, yes this is correct.  This allows you to override modules (even
OpenSCAD primitives) with your own, enhanced versions.  The BOSL2 library
does this a lot. It can be confusing at times, but it is very powerful.

On Fri, Jun 7, 2024 at 7:58 PM Father Horton via Discuss <
discuss@lists.openscad.org> wrote:

When it comes to variables, the last definition in the scope applies. I
think the same thing applies here.

On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss <
discuss@lists.openscad.org> wrote:

The following code does not generate any warnings or errors.  It this
correct behavior?  Using version 2024.01.14 (git 158c5b94f)

Jon

module Pot()
cube(10);

module Pot()
cube(20);

Pot();

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
Virus-free.www.avg.com
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
<#m_6754881744699689146_m_-1805384075366004004_m_6900578273720796704_m_2926902926704344873_m_-2905878328472071567_m_1614698544112551610_m_5027073627314722081_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


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


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


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


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


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


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


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

It wouldn't be hard to devise a syntax for redefining modules to distinguish from modules that are not being redefined. One could imagine "module foo" vs "replace module foo" for example. On Sat, Jun 8, 2024 at 7:44 AM Jon Bondy via Discuss < discuss@lists.openscad.org> wrote: > I agree that it is both useful (when used appropriately) and troublesome > (when used accidentally). The trick is trying to detect the latter without > destroying the former. > On 6/8/2024 7:34 AM, Leonard Martin Struttmann via Discuss wrote: > > I, personally, would want this extended warning mode to be ON by default. > I, too, have spent many hours tracking down why strange things were > happening in my code only to discover that a library that I was using had a > module with the same name as I had. > > However, this "feature" can be quite useful. BOSL2 overrides primitives > such as cube() and cylinder() that work exactly like the OpenSCAD > primitives, while allowing one to position and orient the created shape. > > On Sat, Jun 8, 2024 at 6:06 AM Michael Möller via Discuss < > discuss@lists.openscad.org> wrote: > >> Well, trying to be constructive here, it might be implemented as a >> extended warningmode, off by default. I'm thinking like "lint" in C, a >> nitpicking mode. >> >> Unfortunatly that means a syntax extensions or compiler hints (typically >> a specially formatted comment fex /*!*/) that signals this redefenition is >> intentional. >> >> If the people who use their spare time to implement such extended >> warnings feel this is worthwhile, they could also consider flagging unused >> variables and suchlike. >> >> M² >> >> lør. 8. jun. 2024 12.43 skrev Jon Bondy via Discuss < >> discuss@lists.openscad.org>: >> >>> I claim this is a serious bug. I can't tell you how much time I spent >>> altering a module and seeing nothing change. I imagine it is way too late >>> to change, but it would be helpful if there were SOME utility that allowed >>> one to know that such an over-ride has occurred, ESPECIALLY within a >>> single text file. I cannot see any use for re-defining a module within a >>> file: that surely would deserve a warning. >>> >>> Sigh. >>> On 6/7/2024 11:32 PM, Leonard Martin Struttmann via Discuss wrote: >>> >>> Jon, yes this is correct. This allows you to override modules (even >>> OpenSCAD primitives) with your own, enhanced versions. The BOSL2 library >>> does this a lot. It can be confusing at times, but it is very powerful. >>> >>> On Fri, Jun 7, 2024 at 7:58 PM Father Horton via Discuss < >>> discuss@lists.openscad.org> wrote: >>> >>>> When it comes to variables, the last definition in the scope applies. I >>>> think the same thing applies here. >>>> >>>> On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss < >>>> discuss@lists.openscad.org> wrote: >>>> >>>>> The following code does not generate any warnings or errors. It this >>>>> correct behavior? Using version 2024.01.14 (git 158c5b94f) >>>>> >>>>> Jon >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> module Pot() >>>>> cube(10); >>>>> >>>>> module Pot() >>>>> cube(20); >>>>> >>>>> Pot(); >>>>> >>>>> >>>>> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >>>>> Virus-free.www.avg.com >>>>> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >>>>> <#m_6754881744699689146_m_-1805384075366004004_m_6900578273720796704_m_2926902926704344873_m_-2905878328472071567_m_1614698544112551610_m_5027073627314722081_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >>>>> _______________________________________________ >>>>> OpenSCAD mailing list >>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>> >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
L
larry
Sat, Jun 8, 2024 1:18 PM

On Sat, 2024-06-08 at 06:34 -0500, Leonard Martin Struttmann via
Discuss wrote:

I, personally, would want this extended warning mode to be ON by
default.  I, too, have spent many hours tracking down why strange
things were happening in my code only to discover that a library that
I was using had a module with the same name as I had.

However, this "feature" can be quite useful.  BOSL2 overrides
primitives such as cube() and cylinder() that work exactly like the
OpenSCAD primitives, while allowing one to position and orient the
created shape.

Corect me if I'm wrong, but BOSL2 does not override cube() and
cylinder(). They provide cuboid() and cyl().

On Sat, Jun 8, 2024 at 6:06 AM Michael Möller via Discuss
discuss@lists.openscad.org wrote:

Well, trying to be constructive here, it might be implemented as a
extended warningmode, off by default. I'm thinking like "lint" in
C, a nitpicking mode. 

Unfortunatly that means a syntax extensions or compiler hints
(typically a specially formatted comment fex /!/) that signals
this redefenition is intentional.

If the people who use their spare time to implement such extended
warnings feel this is worthwhile, they could also consider flagging
unused variables and suchlike.

lør. 8. jun. 2024 12.43 skrev Jon Bondy via Discuss
discuss@lists.openscad.org:

I claim this is a serious bug.  I can't tell you how much time I
spent altering a module and seeing nothing change.  I imagine it
is way too late to change, but it would be helpful if there were
SOME utility that allowed one to know that such an over-ride has
occurred, ESPECIALLY  within a single text file.  I cannot see
any use for re-defining a module within a file: that surely would
deserve a warning.
Sigh.
On 6/7/2024 11:32 PM, Leonard Martin Struttmann via Discuss
wrote:
 

Jon, yes this is correct.  This allows you to override modules
(even OpenSCAD primitives) with your own, enhanced versions. 
The BOSL2 library does this a lot. It can be confusing at
times, but it is very powerful.
 
On Fri, Jun 7, 2024 at 7:58 PM Father Horton via Discuss
discuss@lists.openscad.org wrote:
 

When it comes to variables, the last definition in the scope
applies. I think the same thing applies here.
 
On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss
discuss@lists.openscad.org wrote:
 

The following code does not generate any warnings or
errors.  It this correct behavior?  Using version
2024.01.14 (git 158c5b94f)
Jon

module Pot()
     cube(10);
     
 module Pot()
     cube(20);
     
 Pot();   

 Virus-free.www.avg.com
 
 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email to
discuss-leave@lists.openscad.org

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

 
 


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


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


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


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

On Sat, 2024-06-08 at 06:34 -0500, Leonard Martin Struttmann via Discuss wrote: > I, personally, would want this extended warning mode to be ON by > default.  I, too, have spent many hours tracking down why strange > things were happening in my code only to discover that a library that > I was using had a module with the same name as I had. > > However, this "feature" can be quite useful.  BOSL2 overrides > primitives such as cube() and cylinder() that work exactly like the > OpenSCAD primitives, while allowing one to position and orient the > created shape. Corect me if I'm wrong, but BOSL2 does not override cube() and cylinder(). They provide cuboid() and cyl(). > On Sat, Jun 8, 2024 at 6:06 AM Michael Möller via Discuss > <discuss@lists.openscad.org> wrote: > > Well, trying to be constructive here, it might be implemented as a > > extended warningmode, off by default. I'm thinking like "lint" in > > C, a nitpicking mode.  > > > > Unfortunatly that means a syntax extensions or compiler hints > > (typically a specially formatted comment fex /*!*/) that signals > > this redefenition is intentional. > > > > If the people who use their spare time to implement such extended > > warnings feel this is worthwhile, they could also consider flagging > > unused variables and suchlike. > > > > M² > > > > lør. 8. jun. 2024 12.43 skrev Jon Bondy via Discuss > > <discuss@lists.openscad.org>: > > > I claim this is a serious bug.  I can't tell you how much time I > > > spent altering a module and seeing nothing change.  I imagine it > > > is way too late to change, but it would be helpful if there were > > > SOME utility that allowed one to know that such an over-ride has > > > occurred, ESPECIALLY  within a single text file.  I cannot see > > > any use for re-defining a module within a file: that surely would > > > deserve a warning. > > > Sigh. > > > On 6/7/2024 11:32 PM, Leonard Martin Struttmann via Discuss > > > wrote: > > >   > > > > Jon, yes this is correct.  This allows you to override modules > > > > (even OpenSCAD primitives) with your own, enhanced versions.  > > > > The BOSL2 library does this a lot. It can be confusing at > > > > times, but it is very powerful. > > > >   > > > > On Fri, Jun 7, 2024 at 7:58 PM Father Horton via Discuss > > > > <discuss@lists.openscad.org> wrote: > > > >   > > > > > When it comes to variables, the last definition in the scope > > > > > applies. I think the same thing applies here. > > > > >   > > > > > On Fri, Jun 7, 2024 at 6:43 PM Jon Bondy via Discuss > > > > > <discuss@lists.openscad.org> wrote: > > > > >   > > > > > > The following code does not generate any warnings or > > > > > > errors.  It this correct behavior?  Using version > > > > > > 2024.01.14 (git 158c5b94f) > > > > > > Jon > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > module Pot() > > > > > >      cube(10); > > > > > >       > > > > > >  module Pot() > > > > > >      cube(20); > > > > > >       > > > > > >  Pot();    > > > > > > > > > > > >  Virus-free.www.avg.com > > > > > >   > > > > > >  _______________________________________________ > > > > > >  OpenSCAD mailing list > > > > > >  To unsubscribe send an email to > > > > > > discuss-leave@lists.openscad.org > > > > > > > > > > >  _______________________________________________ > > > > >  OpenSCAD mailing list > > > > >  To unsubscribe send an email to > > > > > discuss-leave@lists.openscad.org > > > > > > > > >   > > > >   > > > > _______________________________________________ > > > > OpenSCAD mailing list > > > > To unsubscribe send an email to > > > > discuss-leave@lists.openscad.org > > > _______________________________________________ > > > OpenSCAD mailing list > > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org