Hello all,
I have a challenge, which is this: I'd like to have a public property which will
return a reference to an internally stored class instance.
ref MyClass myProperty() @property
{
...
}
However, this runs into a problem: I can't use "static" to internally store a
On 12/08/2013 10:00 AM, Joseph Rushton Wakeling wrote:
> I have a challenge, which is this: I'd like to have a public property
> which will return a reference to an internally stored class instance.
>
> ref MyClass myProperty() @property
> {
> ...
> }
First, the usual que
On 08/12/13 21:12, Ali Çehreli wrote:
In any case, I think class static this is the solution:
I think I may have misled you by talking about properties, because I _don't_
mean a property of a class. I mean a public standalone function that is marked
as a @property, which returns a persistent
On Sunday, 8 December 2013 at 21:32:35 UTC, Joseph Rushton
Wakeling wrote:
On 08/12/13 21:12, Ali Çehreli wrote:
In any case, I think class static this is the solution:
I think I may have misled you by talking about properties,
because I _don't_ mean a property of a class. I mean a public
s
On 12/08/2013 02:40 PM, qznc wrote:
I understand you are talking about the "Singleton" design pattern.
You might want to look how std.parallelism does it with the default
global thread pool.
https://github.com/D-Programming-Language/phobos/blob/master/std/parallelism.d#L3261
David Simcha pres
On Monday, 9 December 2013 at 00:24:44 UTC, Ali Çehreli wrote:
David Simcha presented it as a D-specific pattern and explained
how D avoids at least one of the bugs of double-checked locking:
http://www.youtube.com/watch?feature=player_detailpage&v=yMNMV9JlkcQ#t=1676
I will look at this in d
On 09/12/13 01:24, Ali Çehreli wrote:
On 12/08/2013 02:40 PM, qznc wrote:
I understand you are talking about the "Singleton" design pattern.
You might want to look how std.parallelism does it with the default
global thread pool.
https://github.com/D-Programming-Language/phobos/blob/master/std/
On Monday, 9 December 2013 at 06:43:05 UTC, Joseph Rushton
Wakeling wrote:
On 09/12/13 01:24, Ali Çehreli wrote:
On 12/08/2013 02:40 PM, qznc wrote:
I understand you are talking about the "Singleton" design
pattern.
You might want to look how std.parallelism does it with the
default
global t
On Monday, December 09, 2013 06:19:19 Joseph Rushton Wakeling wrote:
> On Monday, 9 December 2013 at 00:24:44 UTC, Ali Çehreli wrote:
> > David Simcha presented it as a D-specific pattern and explained
> > how D avoids at least one of the bugs of double-checked locking:
> >
> >
> > http://www.you
On 10/12/13 06:33, Jonathan M Davis wrote:
It's still essentially a singleton - it's just that it's a single instance per
thread in that case instead of per program. And you avoid all of the
threading-related initialization issues with singletons if it's thread-local.
Just check whether it's null
On Tuesday, December 10, 2013 08:41:25 Joseph Rushton Wakeling wrote:
> On 10/12/13 06:33, Jonathan M Davis wrote:
> > It's still essentially a singleton - it's just that it's a single instance
> > per thread in that case instead of per program. And you avoid all of the
> > threading-related initia
On 10/12/13 08:44, Jonathan M Davis wrote:
Yeah. Something like that.
What I like is that it actually comes out slightly nicer than the existing code
-- you don't need an extra static boolean to check if the RNG has been
initialized. This experience is proving typical of class-based RNG and
On Tuesday, December 10, 2013 09:13:12 Joseph Rushton Wakeling wrote:
> On 10/12/13 08:44, Jonathan M Davis wrote:
> > It's a matter of what you can directly initialize a non-local variable
> > with. Module-level variables, static variables, and member variables all
> > have to be known at compile
On 10/12/13 09:27, Jonathan M Davis wrote:
A lot of dmd's error messages aren't great.
Would this be better?
Cannot initialize thread-local class variable %s with a mutable value.
Only const or immutable initial values are allowed (e.g. null).
That would be better.
https://github.com
On Tuesday, 10 December 2013 at 09:50:56 UTC, Joseph Rushton
Wakeling wrote:
On 10/12/13 09:27, Jonathan M Davis wrote:
A lot of dmd's error messages aren't great.
Would this be better?
Cannot initialize thread-local class variable %s with a
mutable value.
Only const or immutable initia
On Tuesday, 10 December 2013 at 09:50:56 UTC, Joseph Rushton
Wakeling wrote:
On 10/12/13 09:27, Jonathan M Davis wrote:
A lot of dmd's error messages aren't great.
Would this be better?
Cannot initialize thread-local class variable %s with a
mutable value.
Only const or immutable initia
On 10/12/13 11:31, qznc wrote:
The changelog is partially generated from Bugzilla issues. That was the main
reason to also add issues for pull request, afaik.
Fair enough :-)
https://d.puremagic.com/issues/show_bug.cgi?id=11714
17 matches
Mail list logo