On Sunday, 14 November 2021 at 05:12:58 UTC, Andrey Zherikov
wrote:
Here is my code:
[...]
`W()` (2) works as expected but is it possible to achieve the
same without parenthesis so `getAttributes` trait returns
`tuple(L("app.d", 16LU))` for (1)?
No, without parens this is really the function
Here is my code:
```d
struct L
{
string file;
size_t line;
}
auto W(string f = __FILE__,size_t l= __LINE__)()
{
return L(f,l);
}
struct A
{
@W // (1): line# 16
{
int a;
int b;
}
@W() // (2): line# 21
{
int c;
int d;
}
}
void main()
{
pragma(
On Sunday, 14 November 2021 at 04:24:09 UTC, Stanislav Blinov
wrote:
On Sunday, 14 November 2021 at 04:05:45 UTC, forkit wrote:
However, there is no isClass method. Why not?
How do I determine if a member is a class.. I wonder...
```
static if (is(something == class)) { /* ... */ }
```
or,
On Saturday, 13 November 2021 at 23:02:15 UTC, pascal111 wrote:
I touch that D is big language, it's not small like standard C.
This will cost me much studying, so I think I need slow down
and learn it step by step.
Yes. C is so much smaller, and thus simpler (till you wanna do
something co
On Sunday, 14 November 2021 at 04:05:45 UTC, forkit wrote:
However, there is no isClass method. Why not?
How do I determine if a member is a class.. I wonder...
```
static if (is(something == class)) { /* ... */ }
```
or, if member is an instance
```
static if (is(typeof(something) == class
On Saturday, 13 November 2021 at 17:22:16 UTC, Stanislav Blinov
wrote:
On Saturday, 13 November 2021 at 08:04:56 UTC, forkit wrote:
int i;
foreach(m; __traits(allMembers, mixin(__MODULE__)))
// ...
__traits(getLocation, mixin(m))[1]);
What you really should be doing is this:
On Saturday, 13 November 2021 at 22:52:55 UTC, pascal111 wrote:
When I'm searching for "toUpper" and "toLower" functions that
string type uses
They are usable though `import std.string;` the docs just don't
do a great job showing that.
The newest test version of my doc generator does integra
On Saturday, 13 November 2021 at 22:52:55 UTC, pascal111 wrote:
When I'm searching for "toUpper" and "toLower" functions that
string type uses, I confused when I reached the module
"std.string". In the first section of its page
"https://dlang.org/phobos/std_string.html"; I didn't found
functio
On Thursday, 11 November 2021 at 22:30:12 UTC, forkit wrote:
On Tuesday, 2 November 2021 at 23:45:39 UTC, pascal111 wrote:
[...]
ok.. for a more on topic response..
First: Please name your variables sensibly:
char negativity, even; // grrr!!!
char answer1, answer2; // makes so m
On Saturday, 13 November 2021 at 22:52:55 UTC, pascal111 wrote:
When I'm searching for "toUpper" and "toLower" functions that
string type uses, I confused when I reached the module
"std.string". In the first section of its page
"https://dlang.org/phobos/std_string.html"; I didn't found
functio
When I'm searching for "toUpper" and "toLower" functions that
string type uses, I confused when I reached the module
"std.string". In the first section of its page
"https://dlang.org/phobos/std_string.html"; I didn't found
functions I'm searching for, but when I pressed ctrl+f and typed
functi
On Saturday, 13 November 2021 at 08:04:56 UTC, forkit wrote:
int i;
foreach(m; __traits(allMembers, mixin(__MODULE__)))
// ...
__traits(getLocation, mixin(m))[1]);
What you really should be doing is this:
```d
static import mod = mixin(__MODULE__);
foreach (i, name; __traits(a
On Friday, 12 November 2021 at 00:46:05 UTC, Elronnd wrote:
On Thursday, 11 November 2021 at 13:22:15 UTC, Basile B. wrote:
As for now, I know no compiler that can do that.
GCC can do it. Somewhat notoriously,
you meant "infamously" ?
LTO can lead to bugs from underspecified asm constraint
On Saturday, 13 November 2021 at 07:20:14 UTC, Ali Çehreli wrote:
It works because we mix-in the value of the string 'm', which
becomes a symbol.
('foreach' instead of 'static foreach' works as well.)
Ali
Thanks. Really appreciate the help provided in this thread :-)
Final working code be
14 matches
Mail list logo