digitalmars.D - feature request: nim's compilation option pragmas
- Timothee Cour via Digitalmars-d (14/14) Dec 17 2016 Could we support something similar to nim's compilation option pragmas [...
- Stefan Koch (5/22) Dec 17 2016 That approach has a number of problems.
- Basile B. (3/20) Dec 18 2016 Afaik this Nim feature is inspired from Object Pascal:
Could we support something similar to nim's compilation option pragmas [1]:
```
{.push checks: off.}
```
in D could look like:
```
pragma(push, "-noboundscheck -O -release");
// compile this section with specified flags as it's critical
pragma(pop);
```
[1] http://nim-lang.org/docs/manual.html#pragmas-compilation-option-pragmas
Dec 17 2016
On Sunday, 18 December 2016 at 04:46:34 UTC, Timothee Cour wrote:
Could we support something similar to nim's compilation option
pragmas [1]:
```
{.push checks: off.}
critical
```
in D could look like:
```
pragma(push, "-noboundscheck -O -release");
// compile this section with specified flags as it's critical
pragma(pop);
```
[1]
http://nim-lang.org/docs/manual.html#pragmas-compilation-option-pragmas
That approach has a number of problems.
Basically the optimizer works at module scope, I'd be difficult
to constrain it's use.
Secondly what happens if conflicting options are nested ?
Dec 17 2016
On Sunday, 18 December 2016 at 04:46:34 UTC, Timothee Cour wrote:
Could we support something similar to nim's compilation option
pragmas [1]:
```
{.push checks: off.}
critical
```
in D could look like:
```
pragma(push, "-noboundscheck -O -release");
// compile this section with specified flags as it's critical
pragma(pop);
```
[1]
http://nim-lang.org/docs/manual.html#pragmas-compilation-option-pragmas
Afaik this Nim feature is inspired from Object Pascal:
http://www.freepascal.org/docs-html/3.0.0/prog/progsu63.html.
Dec 18 2016









Stefan Koch <uplink.coder googlemail.com> 