On Monday, 15 January 2024 at 23:06:00 UTC, Steven Schveighoffer
wrote:
As a workaround, you can alias the outer function in the struct:
```d
struct S
{
alias foo = S_foo;
}
```
This might be less than ideal, but at least it works.
It does! And it's good enough for me. Thanks a lot!
--
On Monday, 15 January 2024 at 22:23:27 UTC, Bastiaan Veelo wrote:
On Monday, 15 January 2024 at 18:43:43 UTC, user1234 wrote:
The two calls are not equivalent.
so what is passed as alias need to be static too.
Thanks all. I thought a static member function just isn't able
to access the
On Monday, 15 January 2024 at 18:34:58 UTC, H. S. Teoh wrote:
On Mon, Jan 15, 2024 at 06:16:44PM +, Bastiaan Veelo via
Digitalmars-d-learn wrote:
Hey people, I can use some help understanding why the last
line produces a compile error.
```d
import std.stdio;
struct S
{
static void
On Monday, 15 January 2024 at 18:43:43 UTC, user1234 wrote:
The two calls are not equivalent.
so what is passed as alias need to be static too.
Thanks all. I thought a static member function just isn't able to
access the instance of the struct, but as I understand now it is
static all the
On Monday, 15 January 2024 at 18:16:44 UTC, Bastiaan Veelo wrote:
[...]
It seems to me this should just work.
Thanks!
--Bastiaan.
The two calls are not equivalent. To be equivalent you need to
set `S_foo` static too, otherwise `S_Foo` is instanciated in
`main` scope, proof:
```d
import
On Mon, Jan 15, 2024 at 06:16:44PM +, Bastiaan Veelo via
Digitalmars-d-learn wrote:
> Hey people, I can use some help understanding why the last line
> produces a compile error.
>
> ```d
> import std.stdio;
>
> struct S
> {
> static void foo(alias len)()
[...]
The trouble is with the
On Monday, 15 January 2024 at 18:16:44 UTC, Bastiaan Veelo wrote:
Hey people, I can use some help understanding why the last line
produces a compile error.
```d
import std.stdio;
struct S
{
static void foo(alias len)()
{
writeln(len);
}
}
void S_foo(alias len)()
{
Hey people, I can use some help understanding why the last line
produces a compile error.
```d
import std.stdio;
struct S
{
static void foo(alias len)()
{
writeln(len);
}
}
void S_foo(alias len)()
{
writeln(len);
}
void main()
{
const five = 5;
S_foo!five; //