On 1/12/21 2:49 PM, ryuukk_ wrote:
On Tuesday, 12 January 2021 at 18:44:53 UTC, Jonathan Levi wrote:
On Tuesday, 12 January 2021 at 17:46:14 UTC, Q. Schroll wrote:
It's obvious why arrays work, it's the primary use case. I have no
idea why classes are allowed. That classes are allowed, but stru
On 1/12/21 12:46 PM, Q. Schroll wrote:
On Tuesday, 12 January 2021 at 17:26:15 UTC, Jonathan Levi wrote:
Why is this not working?
```
struct S {
int x;
string y;
}
void fun(S s ...) {
This is intended for arrays and classes, not structs. Using ... for
something other than arrays and
On Tuesday, 12 January 2021 at 18:44:53 UTC, Jonathan Levi wrote:
On Tuesday, 12 January 2021 at 17:46:14 UTC, Q. Schroll wrote:
It's obvious why arrays work, it's the primary use case. I
have no idea why classes are allowed. That classes are
allowed, but structs are not, makes no sense to me.
On Tuesday, 12 January 2021 at 18:44:53 UTC, Jonathan Levi wrote:
On Tuesday, 12 January 2021 at 17:46:14 UTC, Q. Schroll wrote:
It's obvious why arrays work, it's the primary use case. I
have no idea why classes are allowed. That classes are
allowed, but structs are not, makes no sense to me.
On 1/12/21 10:44 AM, Jonathan Levi wrote:
> why does `fun` still compile?
I'm not familiar with that particular syntax, I don't know why it
compiles, and I don't know why structs are different. :) However, it
looks very much like the following *slice* syntax:
void fun(S[] s...) {
writeln
On Tuesday, 12 January 2021 at 17:46:14 UTC, Q. Schroll wrote:
It's obvious why arrays work, it's the primary use case. I have
no idea why classes are allowed. That classes are allowed, but
structs are not, makes no sense to me.
I like the variadic feature for classes, but I wish it worked for
On Tuesday, 12 January 2021 at 17:26:15 UTC, Jonathan Levi wrote:
Why is this not working?
```
struct S {
int x;
string y;
}
void fun(S s ...) {
This is intended for arrays and classes, not structs. Using ...
for something other than arrays and c
fun(S(5,"hi"));
That one sho
Why is this not working?
```
struct S {
int x;
string y;
}
void fun(S s ...) {
writeln(s);
}
void main() {
fun(S(5,"hi"));
fun(5,"hi");
}
```
Why does `fun` compile if calling it does not?