Stack Exchange
s = StructType(1, 2) is to s = new StructType(1, 2) as s = { a:1, b:2 } is to \?\?\?\?
The short version: 
What is the D-lang struct * declaration that is equivalent to the struct literal declaration { a:1, b:2 }?
The longer version:
I have a D-lang struct representing nodes of different type (int, string, etc.). Each node has common fields (eg. node type) and fields specific to each node type (eg. int_value, str_value).
struct NodeType {
    DataType data_type;
    union {
        long int_value;
        string str_value;
        double dbl_value;
    }
}

I am returning these from a function and since they are value types, I have to return them as NodeType * rather than as NodeType. (If this is not true, please tell me how to return a NodeType from a function.)
As a stylistic and idiomatic preference, I want to return these structs with something like
return new ExprType(StrType, "Input text");              // A

or
return { data_type:StrType, str_value:"Input text" };    // B

rather than the way far too clunky by half again already
ExprType *e = new ExprType(StrType);                     // C
e.str_value = "Input text";
return e;

I can not use the constructor syntax (A) because that would assign "Input text" to int_value and Error: cannot implicitly convert expression ("Input text") of type string to long ensues.
The literal syntax (B) is wrong because it is declaring an ExprType and not an ExprType *.
My question: What is the ExprType * literal declaration that is equivalent to the ExprType declaration B?
An almost equivalent question: Is there is a version of the constructor syntax that allows something like a named parameter? For instance:
return new ExprType(StrType, str_value: "Input text");

Thank you.

DIP for named parameters (aka in-place struct initialization) can be found here: https://github.com/dlang/DIPs/pull/22

There are no named parameters in D. It's been discussed, but at the moment there are none.
If this is a struct, you can absolutely return it as a value type:
return NodeType(something);

simply works. Or you can use the GC like you're doing. Either one.
In your particular case, what I'd do is define three constructors. One for string, one for double and one for ulong, and have those constructors fill in data_type:
this(string str) {
  this.str_value = str;
  this.data_type = DataType.StrType;
}

Shachar

Adding a ctor for each type might be the simplest way. There are actually about 10 datatypes so far (with more coming), not just 3, so that could get a bit samey though.

On third thoughts, overriding the ctor with differently typed parameters will not be enough. There are datatypes in my program (eg. symbol, keyword, comment, str) represented by the one D string type.
I'm going to need all the str_expr(), int_expr(), sym_expr(), etc functions afterall. Macros, anyone?

Is return {data_type:DataType.StrType, str_value: str} possible with a function that has been declared to return NodeType?
NodeType n = {data_type:DataType.StrType, str_value: str}; return n; would work if that's as close as D gets.

I am not aware that D has, at this time, struct initialization by member name, so no, it will not work. You can, however, create an instance of your return type on the stack, initialize it in whatever way you want, and then return that by value.

D has block initialization syntax for newly declared variables:
ExprType mytype = {
    data_type: StrType,
    str_value: "asdf",
};

Unfortunately, this only works for variable initialization. There is no "struct literal" syntax in D yet.
You might also consider using static factory methods. They won't suffer from overload conflicts like constructors do, and they can perform checks and assertions that aren't possible using the block initialization syntax (ex. can't use int_value with IntType or something like that).
static ExprType str(string val) {
    ExprType v = {
        data_type: StrType,
        str_value: "asdf",
    };
    return v;
}

auto mytype = ExprType.str("asdf");

(Although it would be a bit complicated, you can theoretically generate such static methods automatically using templates)
