Bug 17472 – [Reg 2.075] typeof(stdin) is no longer a File
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-06-06T22:05:45Z
Last change time
2018-01-05T13:29:11Z
Assigned to
No Owner
Creator
Martin Nowak
Comments
Comment #0 by code — 2017-06-06T22:05:45Z
cat > bug.d << CODE
import std.stdio;
private void threadWriter(alias OUT, alias ERR)()
{
OUT = typeof(OUT)("/dev/null", "w");
ERR = typeof(ERR)("/dev/null", "w");
}
alias stdWriter = threadWriter!(stdout, stderr);
CODE
dmd -c bug
----
/home/dawg/Code/D/bug.d(5): Error: expected 0 arguments, not 2 for non-variadic function type nothrow @nogc ref @system File()
/home/dawg/Code/D/bug.d(6): Error: expected 0 arguments, not 2 for non-variadic function type nothrow @nogc ref @system File()
/home/dawg/Code/D/bug.d(9): Error: template instance bug.threadWriter!(makeGlobal, makeGlobal) error instantiating
----
Breaks https://github.com/atilaneves/unit-threaded.
Happens because stdin is now an alias.
alias stdin = makeGlobal!(core.stdc.stdio.stdin);
Introduced with https://github.com/dlang/phobos/pull/5421
Comment #1 by andrei — 2017-06-06T23:17:16Z
I think we should change client code. It is understood that the change is liable to regressions. We really should get rid of library initialization code.
Comment #2 by code — 2017-06-09T12:30:02Z
(In reply to Andrei Alexandrescu from comment #1)
> We really should get rid of library initialization
> code.
Why did that became a goal btw?
Comment #3 by andrei — 2017-06-09T12:44:14Z
(In reply to Martin Nowak from comment #2)
> (In reply to Andrei Alexandrescu from comment #1)
> > We really should get rid of library initialization
> > code.
>
> Why did that became a goal btw?
Thanks for asking. It's "Better support for C-style libraries with light or no runtime" in https://wiki.dlang.org/Vision/2017H1. Initializing all of druntime and phobos lazily would make a lot of things better.
Comment #4 by github-bugzilla — 2017-06-09T13:33:15Z