www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - C++ const expression are not that const after all

reply "deadalnix" <deadalnix gmail.com> writes:
Interesting read, and the conclusion beg the question: why using 
a sublanguage for const expression, if it do not provides the 
guarantee it is supposed to.

http://b.atch.se/posts/non-constant-constant-expressions/
Apr 27 2015
next sibling parent reply "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com> writes:
On Tue, Apr 28, 2015 at 02:24:01AM +0000, deadalnix via Digitalmars-d wrote:
 Interesting read, and the conclusion beg the question: why using a
 sublanguage for const expression, if it do not provides the guarantee
 it is supposed to.
 
 http://b.atch.se/posts/non-constant-constant-expressions/
Whoa. This is gonna give me nightmares tonight... that is absolutely insane. Yet another proof that something is fundamentally screwed up with the C++ template system... Now I'm certain beyond any doubt that I am *not* going back to C++, ever. T -- I see that you JS got Bach.
Apr 27 2015
parent reply "Luc Bourhis" <ljbo nowhere.com> writes:
On Tuesday, 28 April 2015 at 02:48:09 UTC, H. S. Teoh wrote:
 On Tue, Apr 28, 2015 at 02:24:01AM +0000, deadalnix via 
 Digitalmars-d wrote:
 http://b.atch.se/posts/non-constant-constant-expressions/
Whoa. This is gonna give me nightmares tonight... that is absolutely insane.
The author of that blog seems to see his finding in a positive light actually. As it makes it possible to write more powerful template metaprograms!
Apr 28 2015
next sibling parent "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com> writes:
On Tue, Apr 28, 2015 at 12:20:31PM +0000, Luc Bourhis via Digitalmars-d wrote:
 On Tuesday, 28 April 2015 at 02:48:09 UTC, H. S. Teoh wrote:
On Tue, Apr 28, 2015 at 02:24:01AM +0000, deadalnix via Digitalmars-d
wrote:
http://b.atch.se/posts/non-constant-constant-expressions/
Whoa. This is gonna give me nightmares tonight... that is absolutely insane.
The author of that blog seems to see his finding in a positive light actually. As it makes it possible to write more powerful template metaprograms!
Somebody should enlighten him concerning D. ;-) T -- Chance favours the prepared mind. -- Louis Pasteur
Apr 28 2015
prev sibling parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Luc Bourhis:

 The author of that blog seems to see his finding in a
 positive light actually. As it makes it possible to write
 more powerful template metaprograms!
One of the essences of modern languages is to restrict the power of the programmer in specific parts, to reduce unwanted interactions and make complexity more manageable. His finding seems a design mistake. Bye, bearophile
Apr 28 2015
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 4/28/2015 8:16 AM, bearophile wrote:
 Luc Bourhis:

 The author of that blog seems to see his finding in a
 positive light actually. As it makes it possible to write
 more powerful template metaprograms!
One of the essences of modern languages is to restrict the power of the programmer in specific parts, to reduce unwanted interactions and make complexity more manageable. His finding seems a design mistake.
Most languages suffer from quirky, unexpected behaviors from interactions between otherwise sensible features. The awful thing, though, is programmers discover these things and then build a store around them, making it impossible to fix those quirks.
Apr 28 2015
parent reply "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com> writes:
On Tue, Apr 28, 2015 at 01:56:01PM -0700, Walter Bright via Digitalmars-d wrote:
 On 4/28/2015 8:16 AM, bearophile wrote:
Luc Bourhis:

The author of that blog seems to see his finding in a
positive light actually. As it makes it possible to write
more powerful template metaprograms!
One of the essences of modern languages is to restrict the power of the programmer in specific parts, to reduce unwanted interactions and make complexity more manageable. His finding seems a design mistake.
Most languages suffer from quirky, unexpected behaviors from interactions between otherwise sensible features. The awful thing, though, is programmers discover these things and then build a store around them, making it impossible to fix those quirks.
Are you certain D doesn't suffer from the same problem? ;-) T -- There is no gravity. The earth sucks.
Apr 28 2015
parent Steven Schveighoffer <schveiguy yahoo.com> writes:
On 4/28/15 5:45 PM, H. S. Teoh via Digitalmars-d wrote:
 On Tue, Apr 28, 2015 at 01:56:01PM -0700, Walter Bright via Digitalmars-d
wrote:
 On 4/28/2015 8:16 AM, bearophile wrote:
 Luc Bourhis:

 The author of that blog seems to see his finding in a
 positive light actually. As it makes it possible to write
 more powerful template metaprograms!
One of the essences of modern languages is to restrict the power of the programmer in specific parts, to reduce unwanted interactions and make complexity more manageable. His finding seems a design mistake.
Most languages suffer from quirky, unexpected behaviors from interactions between otherwise sensible features. The awful thing, though, is programmers discover these things and then build a store around them, making it impossible to fix those quirks.
Are you certain D doesn't suffer from the same problem? ;-)
What? You haven't visited the property store yet? -Steve
Apr 28 2015
prev sibling parent reply "Dicebot" <public dicebot.lv> writes:
On Tuesday, 28 April 2015 at 02:24:02 UTC, deadalnix wrote:
 Interesting read, and the conclusion beg the question: why 
 using a sublanguage for const expression, if it do not provides 
 the guarantee it is supposed to.

 http://b.atch.se/posts/non-constant-constant-expressions/
If someone discovers similar hole in D - please, I beg you, don't try building a library on top of it. Report a bug instead :)
Apr 28 2015
next sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 4/28/15 4:13 PM, Dicebot wrote:
 On Tuesday, 28 April 2015 at 02:24:02 UTC, deadalnix wrote:
 Interesting read, and the conclusion beg the question: why using a
 sublanguage for const expression, if it do not provides the guarantee
 it is supposed to.

 http://b.atch.se/posts/non-constant-constant-expressions/
If someone discovers similar hole in D - please, I beg you, don't try building a library on top of it. Report a bug instead :)
FWIW this is addressed as a defect by the C++ std committee. -- Andrei
Apr 28 2015
prev sibling parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 4/28/2015 4:13 PM, Dicebot wrote:
 On Tuesday, 28 April 2015 at 02:24:02 UTC, deadalnix wrote:
 Interesting read, and the conclusion beg the question: why using a sublanguage
 for const expression, if it do not provides the guarantee it is supposed to.

 http://b.atch.se/posts/non-constant-constant-expressions/
If someone discovers similar hole in D - please, I beg you, don't try building a library on top of it. Report a bug instead :)
Yes, many times, yes. Report it to bugzilla as a bug. Any code relying on buggy behavior listed in bugzilla is likely to get little sympathy from the D community when it breaks due to a bugfix.
Apr 28 2015
parent reply Jacob Carlborg <doob me.com> writes:
On 2015-04-29 02:49, Walter Bright wrote:

 Yes, many times, yes. Report it to bugzilla as a bug. Any code relying
 on buggy behavior listed in bugzilla is likely to get little sympathy
 from the D community when it breaks due to a bugfix.
The most difficult part is to figure if a weird behavior is a bug or not. -- /Jacob Carlborg
Apr 29 2015
next sibling parent "Daniel Murphy" <yebbliesnospam gmail.com> writes:
"Jacob Carlborg"  wrote in message news:mhq0cq$k3h$1 digitalmars.com...

 The most difficult part is to figure if a weird behavior is a bug or not.
I don't think I'm the only one that looks at all of the new bugzilla issues. It might take a while, but an invalid bug in bugzilla should get closed with an explanation eventually. One useful entry-level task for people who want to contribute is going through the new (and old) issues to add keywords, reduce test cases, add more informative titles and close duplicates. This is how I got started, before I was contributing to the compiler.
Apr 29 2015
prev sibling next sibling parent "deadalnix" <deadalnix gmail.com> writes:
On Wednesday, 29 April 2015 at 07:14:34 UTC, Jacob Carlborg wrote:
 On 2015-04-29 02:49, Walter Bright wrote:

 Yes, many times, yes. Report it to bugzilla as a bug. Any code 
 relying
 on buggy behavior listed in bugzilla is likely to get little 
 sympathy
 from the D community when it breaks due to a bugfix.
The most difficult part is to figure if a weird behavior is a bug or not.
http://www.vaikan.com/wordpress/wp-content/uploads/2014/11/f763312cf3b15d96718db268c39edebf-d2z0z5x.jpg
Apr 29 2015
prev sibling parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 4/29/2015 12:14 AM, Jacob Carlborg wrote:
 On 2015-04-29 02:49, Walter Bright wrote:

 Yes, many times, yes. Report it to bugzilla as a bug. Any code relying
 on buggy behavior listed in bugzilla is likely to get little sympathy
 from the D community when it breaks due to a bugfix.
The most difficult part is to figure if a weird behavior is a bug or not.
Mutable const sure has a buggy smell about it. If it's not a bug, then someone will mark the bugzilla issue as "invalid".
Apr 29 2015
parent "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com> writes:
On Wed, Apr 29, 2015 at 12:06:50PM -0700, Walter Bright via Digitalmars-d wrote:
 On 4/29/2015 12:14 AM, Jacob Carlborg wrote:
On 2015-04-29 02:49, Walter Bright wrote:

Yes, many times, yes. Report it to bugzilla as a bug. Any code
relying on buggy behavior listed in bugzilla is likely to get little
sympathy from the D community when it breaks due to a bugfix.
The most difficult part is to figure if a weird behavior is a bug or not.
Mutable const sure has a buggy smell about it.
It's definitely an oxymoron, bug or not! T -- Those who don't understand D are condemned to reinvent it, poorly. -- Daniel N
Apr 29 2015