how is this array subtyping inside struct (bug?) possible?

Kagamin spam at here.lot
Sat Aug 15 13:14:24 UTC 2020


On Monday, 10 August 2020 at 21:20:11 UTC, mw wrote:
> Yes, it's the library did it wrong, I still hold the opinion 
> that:
>
> `writeln` should be a *view* (i.e read-only) function, it 
> shouldn't *internally* call anything thing that change the data 
> passed in.

This would disable writeln features people already use, you can 
create a simple const-flavored writeln wrapper:

void writeln(Args...)(in Args a)
{
     static import std.stdio;
     std.stdio.writeln(a);
}

int main(string[] args)
{
     Filenames a=new Filenames;
     writeln(a);
     return 0;
}


More information about the Digitalmars-d mailing list