Am 24.09.2011, 07:28 Uhr, schrieb Mehrdad :
On 9/23/2011 8:11 PM, Jonathan M Davis wrote:
On Friday, September 23, 2011 19:42:24 Walter Bright wrote:
On 9/23/2011 6:55 PM, Jonathan M Davis wrote:
True, but it doesn't just happen. You have to choose to make a
variable
mutable.
Which you *mus
On 26.09.2011 16:14, Steven Schveighoffer wrote:
On Sat, 24 Sep 2011 04:46:07 -0400, Rainer Schuetze
wrote:
On 9/24/2011 9:30 AM, Andrei Alexandrescu wrote:
On 9/24/11 1:12 CDT, Rainer Schuetze wrote:
On 9/22/2011 4:10 PM, Andrei Alexandrescu wrote:
On 9/22/11 3:02 AM, Peter Alexander
On 26.09.2011 08:32, Jonathan M Davis wrote:
On Monday, September 26, 2011 08:14:31 Rainer Schuetze wrote:
Which finally brings us back to the original question: What does
immutable guarantee in the face of non-pure property getter functions?
immutable guarantees that when an object is immut
On Fri, 23 Sep 2011 20:05:16 -0400, Walter Bright
wrote:
On 9/23/2011 3:46 PM, Peter Alexander wrote:
On 23/09/11 6:48 AM, Walter Bright wrote:
On 9/22/2011 4:39 AM, bearophile wrote:
Walter:
"logical const" in C++ is faith-based programming.
I think you're exaggerating it's uselessness
On Fri, 23 Sep 2011 20:13:39 -0400, Walter Bright
wrote:
On 9/23/2011 4:13 PM, Jonathan M Davis wrote:
But while C++'s const is not as good as D's const, it's still very
worthwhile
IMHO.
To me it's like buffer overflows. 99% of C/C++ code doesn't have buffer
overflows, and is perfectly
On Sat, 24 Sep 2011 04:46:07 -0400, Rainer Schuetze
wrote:
On 9/24/2011 9:30 AM, Andrei Alexandrescu wrote:
On 9/24/11 1:12 CDT, Rainer Schuetze wrote:
On 9/22/2011 4:10 PM, Andrei Alexandrescu wrote:
On 9/22/11 3:02 AM, Peter Alexander wrote:
On 22/09/11 7:04 AM, Andrei Alexandrescu w
On Monday, September 26, 2011 08:14:31 Rainer Schuetze wrote:
> Which finally brings us back to the original question: What does
> immutable guarantee in the face of non-pure property getter functions?
immutable guarantees that when an object is immutable, none of its member
variables will _ever_
On 25.09.2011 04:25, Peter Alexander wrote:
On 24/09/11 4:47 PM, Rainer Schuetze wrote:
Sorry for the bad example, here's one that is not thread-safe, and where
the invariant can fail in a multi-threaded environment:
shared(int) globId;
class C
{
invariant() { assert((globId & 1) == 0); }
@p
On 25/09/11 4:49 AM, Walter Bright wrote:
On 9/24/2011 6:03 AM, Peter Alexander wrote:
I only use const/immutable for concurrency. Nothing else.
How do you avoid race conditions when setting logical const values?
You can't and don't. That's not what logical const is for. That's what
physica
Walter Bright wrote:
> On 9/24/2011 11:00 PM, dame wrote:
>> Walter Bright wrote:
>>> On 9/24/2011 6:03 AM, Peter Alexander wrote:
I only use const/immutable for concurrency. Nothing else.
>>>
>>> How do you avoid race conditions when setting logical const values?
>>
>> Is that important?
>
>
On 9/24/2011 11:00 PM, dame wrote:
Walter Bright wrote:
On 9/24/2011 6:03 AM, Peter Alexander wrote:
I only use const/immutable for concurrency. Nothing else.
How do you avoid race conditions when setting logical const values?
Is that important?
If you have a concurrent data structure, it
Walter Bright wrote:
> On 9/24/2011 6:03 AM, Peter Alexander wrote:
>> I only use const/immutable for concurrency. Nothing else.
>
> How do you avoid race conditions when setting logical const values?
Is that important?
On 9/24/2011 6:03 AM, Peter Alexander wrote:
I only use const/immutable for concurrency. Nothing else.
How do you avoid race conditions when setting logical const values?
On 24/09/11 4:47 PM, Rainer Schuetze wrote:
Sorry for the bad example, here's one that is not thread-safe, and where
the invariant can fail in a multi-threaded environment:
shared(int) globId;
class C
{
invariant() { assert((globId & 1) == 0); }
@property int id() immutable
{
globId = globId +
On 9/24/2011 6:42 PM, Peter Alexander wrote:
On 24/09/11 2:39 PM, Rainer Schuetze wrote:
Is c.id thread-safe? no! Is it constant? no! How does this help in
multi-threaded applications that access c?
It is thread safe. globId is a thread-local variable.
sorry, I noticed this mistake in my e
On 09/24/2011 01:34 AM, Mehrdad wrote:
On 9/23/2011 4:13 PM, Jonathan M Davis wrote:
On Friday, September 23, 2011 15:58 Andrej Mitrovic wrote:
On 9/24/11, Peter Alexander wrote:
On 23/09/11 6:48 AM, Walter Bright wrote:
On 9/22/2011 4:39 AM, bearophile wrote:
Walter:
"logical const" in C++
On 24/09/11 2:39 PM, Rainer Schuetze wrote:
Is c.id thread-safe? no! Is it constant? no! How does this help in
multi-threaded applications that access c?
It is thread safe. globId is a thread-local variable.
sorry, I noticed this mistake in my example too late. Using shared(int)
still compile
On 9/24/2011 3:00 PM, Peter Alexander wrote:
On 24/09/11 9:46 AM, Rainer Schuetze wrote:
On 9/24/2011 9:30 AM, Andrei Alexandrescu wrote:
On 9/24/11 1:12 CDT, Rainer Schuetze wrote:
On 9/22/2011 4:10 PM, Andrei Alexandrescu wrote:
On 9/22/11 3:02 AM, Peter Alexander wrote:
On 22/09/11 7
On 23/09/11 11:58 PM, Andrej Mitrovic wrote:
On 9/24/11, Peter Alexander wrote:
On 23/09/11 6:48 AM, Walter Bright wrote:
On 9/22/2011 4:39 AM, bearophile wrote:
Walter:
"logical const" in C++ is faith-based programming.
I think you're exaggerating it's uselessness.
It's faith-based as mu
On 24/09/11 9:46 AM, Rainer Schuetze wrote:
On 9/24/2011 9:30 AM, Andrei Alexandrescu wrote:
On 9/24/11 1:12 CDT, Rainer Schuetze wrote:
On 9/22/2011 4:10 PM, Andrei Alexandrescu wrote:
On 9/22/11 3:02 AM, Peter Alexander wrote:
On 22/09/11 7:04 AM, Andrei Alexandrescu wrote:
The initial
On 9/24/2011 9:30 AM, Andrei Alexandrescu wrote:
On 9/24/11 1:12 CDT, Rainer Schuetze wrote:
On 9/22/2011 4:10 PM, Andrei Alexandrescu wrote:
On 9/22/11 3:02 AM, Peter Alexander wrote:
On 22/09/11 7:04 AM, Andrei Alexandrescu wrote:
The initial submission got junked so I resubmitted:
http
On 9/24/11 1:12 CDT, Rainer Schuetze wrote:
On 9/22/2011 4:10 PM, Andrei Alexandrescu wrote:
On 9/22/11 3:02 AM, Peter Alexander wrote:
On 22/09/11 7:04 AM, Andrei Alexandrescu wrote:
The initial submission got junked so I resubmitted:
http://www.reddit.com/r/programming/comments/knn5p/thoug
On Saturday, September 24, 2011 08:12:17 Rainer Schuetze wrote:
> On 9/22/2011 4:10 PM, Andrei Alexandrescu wrote:
> > On 9/22/11 3:02 AM, Peter Alexander wrote:
> >> On 22/09/11 7:04 AM, Andrei Alexandrescu wrote:
> >>> The initial submission got junked so I resubmitted:
> >>>
> >>> http://www.re
On 9/22/2011 4:10 PM, Andrei Alexandrescu wrote:
On 9/22/11 3:02 AM, Peter Alexander wrote:
On 22/09/11 7:04 AM, Andrei Alexandrescu wrote:
The initial submission got junked so I resubmitted:
http://www.reddit.com/r/programming/comments/knn5p/thoughts_on_immutability_in_d/
Andrei
Thanks
On 9/23/2011 8:11 PM, Jonathan M Davis wrote:
On Friday, September 23, 2011 19:42:24 Walter Bright wrote:
On 9/23/2011 6:55 PM, Jonathan M Davis wrote:
True, but it doesn't just happen. You have to choose to make a variable
mutable.
Which you *must* do for logical const. And, of course, anythi
On Friday, September 23, 2011 19:42:24 Walter Bright wrote:
> On 9/23/2011 6:55 PM, Jonathan M Davis wrote:
> > True, but it doesn't just happen. You have to choose to make a variable
> > mutable.
>
> Which you *must* do for logical const. And, of course, anything beyond the
> first level is not c
On 9/23/2011 6:55 PM, Jonathan M Davis wrote:
True, but it doesn't just happen. You have to choose to make a variable
mutable.
Which you *must* do for logical const. And, of course, anything beyond the first
level is not const at all, and there's NO WAY to say it is const.
_Some_ effort mu
On Friday, September 23, 2011 18:39:19 Walter Bright wrote:
> On 9/23/2011 5:31 PM, Jonathan M Davis wrote:
> > I have to specifically circumvent the compiler to be
> > able to alter const stuff.
>
> Nope, not with 'mutable' you don't have to circumvent anything. Just change
> it.
True, but it do
On 9/23/2011 5:31 PM, Jonathan M Davis wrote:
I have to specifically circumvent the compiler to be
able to alter const stuff.
Nope, not with 'mutable' you don't have to circumvent anything. Just change it.
On Friday, September 23, 2011 17:13 Walter Bright wrote:
> On 9/23/2011 4:13 PM, Jonathan M Davis wrote:
> > But while C++'s const is not as good as D's const, it's still very
> > worthwhile IMHO.
>
> To me it's like buffer overflows. 99% of C/C++ code doesn't have buffer
> overflows, and is perfe
On 9/23/2011 4:13 PM, Jonathan M Davis wrote:
But while C++'s const is not as good as D's const, it's still very worthwhile
IMHO.
To me it's like buffer overflows. 99% of C/C++ code doesn't have buffer
overflows, and is perfectly reliable. But if someone hands you a 1,000,000 line
program and
On 9/23/2011 3:46 PM, Peter Alexander wrote:
On 23/09/11 6:48 AM, Walter Bright wrote:
On 9/22/2011 4:39 AM, bearophile wrote:
Walter:
"logical const" in C++ is faith-based programming.
I think you're exaggerating it's uselessness.
It's faith-based as much as 'walking down the street assumi
On Friday, September 23, 2011 16:34 Mehrdad wrote:
> So far, the 5% of the code it breaks has made it 95% worthless for me,
> though I'm not sure about others (would love to hear otherwise)...
But _what_ does it break? The lack of logical const is definitely limiting,
but at the moment, I can't t
On 09/23/11 17:46, Peter Alexander wrote:
On 23/09/11 6:48 AM, Walter Bright wrote:
On 9/22/2011 4:39 AM, bearophile wrote:
Walter:
"logical const" in C++ is faith-based programming.
I think you're exaggerating it's uselessness.
It's faith-based as much as 'walking down the street assuming
On 9/23/2011 4:13 PM, Jonathan M Davis wrote:
On Friday, September 23, 2011 15:58 Andrej Mitrovic wrote:
On 9/24/11, Peter Alexander wrote:
On 23/09/11 6:48 AM, Walter Bright wrote:
On 9/22/2011 4:39 AM, bearophile wrote:
Walter:
"logical const" in C++ is faith-based programming.
I think y
On Friday, September 23, 2011 15:58 Andrej Mitrovic wrote:
> On 9/24/11, Peter Alexander wrote:
> > On 23/09/11 6:48 AM, Walter Bright wrote:
> >> On 9/22/2011 4:39 AM, bearophile wrote:
> >>> Walter:
> >> "logical const" in C++ is faith-based programming.
> >
> > I think you're exaggerating it's
On 9/24/11, Peter Alexander wrote:
> On 23/09/11 6:48 AM, Walter Bright wrote:
>> On 9/22/2011 4:39 AM, bearophile wrote:
>>> Walter:
>> "logical const" in C++ is faith-based programming.
>
> I think you're exaggerating it's uselessness.
>
> It's faith-based as much as 'walking down the street ass
On 23/09/11 6:48 AM, Walter Bright wrote:
On 9/22/2011 4:39 AM, bearophile wrote:
Walter:
"logical const" in C++ is faith-based programming.
I think you're exaggerating it's uselessness.
It's faith-based as much as 'walking down the street assuming that the
next person won't stab you' is fa
bearophile , dans le message (digitalmars.D:145005), a écrit :
> So with a lconst array you are allowed to change its contents, but not
> reassign it or change its length. A lconst doesn't implicitly cast to
> immutable.
A solution to your problems could be to use a headconst keyword or
librar
On 9/22/2011 4:39 AM, bearophile wrote:
Walter:
You're right. Logical const is only a convention, since it cannot be
enforced by the compiler.
Even if it can't be enforced in 100% of the cases, I think it's still useful.
So you need to look at the situation from a bit wider point of view.
I
On 22/09/11 1:34 PM, Vladimir Panteleev wrote:
On Thu, 22 Sep 2011 11:02:27 +0300, Peter Alexander
wrote:
Thanks for the reddit'ing. I launched up google analytics this morning
and noticed a sudden spike. That could only mean one thing :-)
I tried adding your blog to Planet D, but I can't fi
On 22/09/11 12:39 PM, bearophile wrote:
Andrei Alexandrescu:
The initial submission got junked so I resubmitted:
http://www.reddit.com/r/programming/comments/knn5p/thoughts_on_immutability_in_d/
A logical const can coexist beside the other two (three) kinds of const of D. For
simplicity I u
On 9/22/11 3:02 AM, Peter Alexander wrote:
On 22/09/11 7:04 AM, Andrei Alexandrescu wrote:
The initial submission got junked so I resubmitted:
http://www.reddit.com/r/programming/comments/knn5p/thoughts_on_immutability_in_d/
Andrei
Thanks for the reddit'ing. I launched up google analytics t
On Thu, 22 Sep 2011 11:02:27 +0300, Peter Alexander
wrote:
Thanks for the reddit'ing. I launched up google analytics this morning
and noticed a sudden spike. That could only mean one thing :-)
I tried adding your blog to Planet D, but I can't figure out how to get an
RSS feed of the D catego
Andrei Alexandrescu:
> The initial submission got junked so I resubmitted:
>
> http://www.reddit.com/r/programming/comments/knn5p/thoughts_on_immutability_in_d/
A logical const can coexist beside the other two (three) kinds of const of D.
For simplicity I use the "lconst" keyword.
lconst works
On 22/09/11 7:04 AM, Andrei Alexandrescu wrote:
The initial submission got junked so I resubmitted:
http://www.reddit.com/r/programming/comments/knn5p/thoughts_on_immutability_in_d/
Andrei
Thanks for the reddit'ing. I launched up google analytics this morning
and noticed a sudden spike. That
The initial submission got junked so I resubmitted:
http://www.reddit.com/r/programming/comments/knn5p/thoughts_on_immutability_in_d/
Andrei
47 matches
Mail list logo