Hi,
When using __gshared for variables at module level, it is my
understanding that they should be initialized in the shared static this
constructor. My question is: When having __gshared variables inside
classes, where should I initialize these? Do classes have a shared
static this
Yeah, D feels like that to me too, sometimes. Anyways, for your question -
would using the struct name be good enough? They're easy to get hold of
and usable in switch statements.
If not, how about this:
import std.typetuple;
struct TypeEnum( T... ) {
static pure nothrow @property
.property = test;
.method = test;
.method(test);
What does -property exactly do?
If you had like a dynamic where you don't know if it's
member is a property or a method. You would choose
method right?
scratch the invalid ones below.
---
.property=test;
On 01/04/2012 11:19 PM, Caligo wrote:
I have a function that looks something like this:
bool fun(double theta, out A a, out B b, out C c){ /* ... */ }
if fun() returns false, then nothing is supposed to be assigned to a,
b, c. If it returns true, then values are assigned to a, b, c. Also,
On 01/04/2012 02:19 PM, Caligo wrote:
I have a function that looks something like this:
bool fun(double theta, out A a, out B b, out C c){ /* ... */ }
if fun() returns false, then nothing is supposed to be assigned to a,
b, c. If it returns true, then values are assigned to a, b, c.
On Wed, Jan 4, 2012 at 4:40 PM, Jesse Phillips
jessekphillip...@gmail.com wrote:
Out parameters are initialized. The declaration you want is:
bool fun(double theta, A a = A.init, B b = B.init, C c = C.init){ /* ... */
}
In my case A, B, and C are structs, so that works the way I wanted it.
On Wednesday, 4 January 2012 at 23:02:24 UTC, Simen Kjærås
wrote:
On Wed, 04 Jan 2012 23:40:28 +0100, Jesse Phillips
jessekphillip...@gmail.com wrote:
On Wednesday, 4 January 2012 at 22:19:28 UTC, Caligo wrote:
1. Are there any other solutions ?
2. Would it make sense to have 'out default
On 1/5/2012 4:14 AM, Alex Rønne Petersen wrote:
Hi,
When using __gshared for variables at module level, it is my
understanding that they should be initialized in the shared static this
constructor. My question is: When having __gshared variables inside
classes, where should I initialize these?
import std.stdio;
void test(T)(lazy T dg)
{
test2(dg);
}
void test2(T)(lazy T dg)
{
dg();// nothing happens
dg()(); // have to use double-invocation instead
}
void main()
{
test({ writeln(test); });
}
Do you think it would be possible for the compiler to avoid wrapping
On 2012-01-04 20:14, Alex Rønne Petersen wrote:
Hi,
When using __gshared for variables at module level, it is my
understanding that they should be initialized in the shared static this
constructor. My question is: When having __gshared variables inside
classes, where should I initialize these?
10 matches
Mail list logo