On Wednesday, 3 June 2020 at 10:11:59 UTC, realhet wrote:
On Tuesday, 2 June 2020 at 20:38:40 UTC, Steven Schveighoffer
wrote:
On 6/2/20 10:51 AM, realhet wrote:
On Tuesday, 2 June 2020 at 13:10:55 UTC, Paul Backus wrote:
On Tuesday, 2 June 2020 at 09:28:01 UTC, realhet wrote:
mixin("int[",
On Tuesday, 2 June 2020 at 20:38:40 UTC, Steven Schveighoffer
wrote:
On 6/2/20 10:51 AM, realhet wrote:
On Tuesday, 2 June 2020 at 13:10:55 UTC, Paul Backus wrote:
On Tuesday, 2 June 2020 at 09:28:01 UTC, realhet wrote:
A month ago I discovered that mixinDeclarations can be used for
types
On 6/2/20 10:51 AM, realhet wrote:
On Tuesday, 2 June 2020 at 13:10:55 UTC, Paul Backus wrote:
On Tuesday, 2 June 2020 at 09:28:01 UTC, realhet wrote:
mixin("@property auto ", k, "() const { return ", v, "; }");
Wow, string mixin can process comma separated list, I gotta remember
this,
On Tuesday, 2 June 2020 at 13:37:25 UTC, Stanislav Blinov wrote:
On Tuesday, 2 June 2020 at 09:28:01 UTC, realhet wrote:
Try UDAs instead of a map:
struct A {
struct G {
@("hauteur") int height;
}
Good idea, thx! I already using UDA's for range and measurement
units.
On Tuesday, 2 June 2020 at 13:10:55 UTC, Paul Backus wrote:
On Tuesday, 2 June 2020 at 09:28:01 UTC, realhet wrote:
mixin("@property auto ", k, "() const { return ", v, "; }");
Wow, string mixin can process comma separated list, I gotta
remember this, thanks!
On Tuesday, 2 June 2020 at 09:28:01 UTC, realhet wrote:
I did it that way:
private enum fieldMap = [ // simple names for descriptive and
structured fields
"hauteur" : "general.height",
"rayon" : "profile.radius",
"plage" : "profile.plage",
"offsetv"
On Tuesday, 2 June 2020 at 09:28:01 UTC, realhet wrote:
static foreach(k, v; fieldMap){ mixin("@property auto $()
const{ return #; }".replace("$", k).replace("#", v)); } //I
know, i know -> AliasSeq :D
You can use std.format.format to do it in one function call:
mixin("@property auto
On Tuesday, 2 June 2020 at 09:28:01 UTC, realhet wrote:
On Tuesday, 2 June 2020 at 09:10:03 UTC, Ali Çehreli wrote:
On 6/2/20 1:56 AM, realhet wrote:
Oh and I can put that function generator mixin thing into a
template as well, that way it is reusable and much nicer.
There are a lot of
On Tuesday, 2 June 2020 at 09:10:03 UTC, Ali Çehreli wrote:
On 6/2/20 1:56 AM, realhet wrote:
> struct A{
>struct B{ int c; }
>B b;
>
>auto f(){
> alias d = b.c;
The spec explicitly says it's not legal: "Aliases cannot be
used for expressions" (Item 10):
On 6/2/20 1:56 AM, realhet wrote:
> struct A{
>struct B{ int c; }
>B b;
>
>auto f(){
> alias d = b.c;
The spec explicitly says it's not legal: "Aliases cannot be used for
expressions" (Item 10):
https://dlang.org/spec/declaration.html#alias
I use nested functions for such
On Tuesday, 2 June 2020 at 09:07:08 UTC, Basile B. wrote:
On Tuesday, 2 June 2020 at 08:56:13 UTC, realhet wrote:
[...]
There's a language rule, expressions cant be aliased, however D
has a bug, some expressions
that look like type can be aliased, then when you use them you
have an error
On Tuesday, 2 June 2020 at 08:56:13 UTC, realhet wrote:
Hello,
I have a 2 level nested struct structure with nice descriptive
field names.
And I thought it will be easy to alias those identifierLists
with a few letter names and do some calculations on them.
But I'm having an error.
struct
Hello,
I have a 2 level nested struct structure with nice descriptive
field names.
And I thought it will be easy to alias those identifierLists with
a few letter names and do some calculations on them.
But I'm having an error.
struct A{
struct B{ int c; }
B b;
auto f(){
alias d =
13 matches
Mail list logo