Thread overview
[Issue 16436] Implement pragma(switches, "")
Aug 27, 2016
b2.temp@gmx.com
Aug 28, 2016
Ketmar Dark
Aug 28, 2016
b2.temp@gmx.com
Aug 28, 2016
Ketmar Dark
Aug 28, 2016
Andrej Mitrovic
Aug 28, 2016
b2.temp@gmx.com
Jun 25, 2017
Vladimir Panteleev
August 27, 2016
https://issues.dlang.org/show_bug.cgi?id=16436

--- Comment #1 from b2.temp@gmx.com ---
pragma(switches, "-inline -O");

--
August 28, 2016
https://issues.dlang.org/show_bug.cgi?id=16436

Ketmar Dark <ketmar@ketmar.no-ip.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ketmar@ketmar.no-ip.org

--- Comment #2 from Ketmar Dark <ketmar@ketmar.no-ip.org> ---
what is wrong with:

#!rdmd -O -inline
import std.stdio;
void main () { writeln("hi!"); }

???

--
August 28, 2016
https://issues.dlang.org/show_bug.cgi?id=16436

--- Comment #3 from b2.temp@gmx.com ---
(In reply to Ketmar Dark from comment #2)
> what is wrong with:
> 
> #!rdmd -O -inline
> import std.stdio;
> void main () { writeln("hi!"); }
> 
> ???

hint: it starts with a "Win" and ends with a "dows".

--
August 28, 2016
https://issues.dlang.org/show_bug.cgi?id=16436

--- Comment #4 from Ketmar Dark <ketmar@ketmar.no-ip.org> ---
so instead of windows users writing bugreports to their OS vendor, we should add completely useless code to the compiler. i somehow doesn't feel that this solution is actually solves anything.

--
August 28, 2016
https://issues.dlang.org/show_bug.cgi?id=16436

Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com

--- Comment #5 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
I don't see why `rdmd` couldn't try to parse the file manually for shebangs and do something special on Windows. This could be an RDMD enhancement request.

--
August 28, 2016
https://issues.dlang.org/show_bug.cgi?id=16436

--- Comment #6 from b2.temp@gmx.com ---
(In reply to Andrej Mitrovic from comment #5)
> I don't see why `rdmd` couldn't try to parse the file manually for shebangs and do something special on Windows. This could be an RDMD enhancement request.

I don't know I've never used rdmd at all. Idea is old: https://forum.dlang.org/post/dtlb84$1ibm$1@digitaldaemon.com

Under windows this pragma could allow to execute with "open with..." directly. (assuming -run is among the pragma args).

--
June 25, 2017
https://issues.dlang.org/show_bug.cgi?id=16436

Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dlang-bugzilla@thecybershad
                   |                            |ow.net
         Resolution|---                         |WONTFIX

--- Comment #7 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
Giving the source code control over compiler behaviour is not desirable for the same reason why letting programs know (at compile time) which switches are active isn't. Many guarantees will no longer hold and debugging things reliably becomes more difficult in general.

Furthermore, a pragma is not a good place for this. Pragmas participate in semantics and can be emitted by CTFE.

Furthermore, compiler switches are heavily specific to the implementation. GDC and LDC each use different sets of switches - their compatibility layer with DMD switches comes as a stand-alone program.

Finally, this is a non-trivial change. The correct avenue for such a proposal would be a DIP.

--