On Sunday, 4 July 2021 at 10:07:08 UTC, jfondren wrote:
Not cleaning up after an Error is thrown is allowed by the D
spec. This enhancement allows much better code to be generated
for `nothrow` code when `scope` is used. It will also not
unwind declarations with destructors in `nothrow` code w
On Sunday, 4 July 2021 at 10:07:08 UTC, jfondren wrote:
On Sunday, 4 July 2021 at 08:24:36 UTC, Luis wrote:
Dennis's explanation makes the most sense:
writeln can throw an Exception, so its presence prevents
nothrow inference, which otherwise permits the (not intended to
be catchable) RangeEr
On Sunday, 4 July 2021 at 10:07:08 UTC, jfondren wrote:
By that, what you're running into is an unpleasant interaction
between
1. scope(exit)s that you're writing
2. Errors being thrown rather than Exceptions
3. anonymous functions getting inferred as nothrow
And a resolution could be to submi
On Sunday, 4 July 2021 at 08:24:36 UTC, Luis wrote:
On Saturday, 3 July 2021 at 22:52:39 UTC, frame wrote:
It works if you replace printf() with writeln() or use
writeln() after. There must be some buffer issue.
Not works as you expected.
Yes, replacing by writeln (better said, putting a wri
On Saturday, 3 July 2021 at 22:52:39 UTC, frame wrote:
On Saturday, 3 July 2021 at 22:04:04 UTC, Luis wrote:
scope(exit) it's syntactic sugar for a classic `try {} finally
{}` . The documentation says that must be executed.
It works if you replace printf() with writeln() or use
writeln() aft
On Saturday, 3 July 2021 at 22:04:04 UTC, Luis wrote:
scope(exit) it's syntactic sugar for a classic `try {} finally
{}` . The documentation says that must be executed.
It works if you replace printf() with writeln() or use writeln()
after. There must be some buffer issue.
On Saturday, 3 July 2021 at 20:46:00 UTC, Steven Schveighoffer
wrote:
On 7/3/21 4:08 PM, frame wrote:
On Saturday, 3 July 2021 at 17:39:18 UTC, Steven Schveighoffer
wrote:
But in practice, the compiler does not have to clean up
anything when an `Error` is thrown. Whether it does or not is
de
On Saturday, 3 July 2021 at 17:47:47 UTC, Dennis wrote:
On Saturday, 3 July 2021 at 17:20:47 UTC, Luis wrote:
scope(exit) inside of a anonymous functions, it's never called.
I think the compiler infers the function `nothrow` since you
don't throw any `Exception`, only an `Error`. Errors repre
On 7/3/21 4:08 PM, frame wrote:
On Saturday, 3 July 2021 at 17:39:18 UTC, Steven Schveighoffer wrote:
But in practice, the compiler does not have to clean up anything when
an `Error` is thrown. Whether it does or not is defined by the
implementation.
This should be really mentionend in the d
On Saturday, 3 July 2021 at 17:39:18 UTC, Steven Schveighoffer
wrote:
But in practice, the compiler does not have to clean up
anything when an `Error` is thrown. Whether it does or not is
defined by the implementation.
This should be really mentionend in the docs? "Guard", yeah...
On Saturday, 3 July 2021 at 17:20:47 UTC, Luis wrote:
scope(exit) inside of a anonymous functions, it's never called.
I think the compiler infers the function `nothrow` since you
don't throw any `Exception`, only an `Error`. Errors represent
unrecoverable bugs, after which the program is in a
On Saturday, 3 July 2021 at 17:20:47 UTC, Luis wrote:
This is intentional ?
...
scope(exit) inside of a anonymous functions, it's never called.
```
$ rdmd --eval 'iota(2).map!((int x) { scope(exit) writeln("got:
", x); return x+1; }).array.writeln'
got: 0
got: 1
[1, 2]
```
Conclusion: it's
On 7/3/21 1:20 PM, Luis wrote:
This is intentional ?
```
should(function void() {
auto emptyStack = SimpleStack!int();
scope(exit) emptyStack.free; // <= This is never called
emptyStack.reserve(16);
emptyStack.top;
}).Throw!R
On Saturday, 3 July 2021 at 17:20:47 UTC, Luis wrote:
This is intentional ?
```
should(function void() {
auto emptyStack = SimpleStack!int();
scope(exit) emptyStack.free; // <= This is never
called
emptyStack.reserve(16);
emptyStack.top;
This is intentional ?
```
should(function void() {
auto emptyStack = SimpleStack!int();
scope(exit) emptyStack.free; // <= This is never
called
emptyStack.reserve(16);
emptyStack.top;
}).Throw!RangeError;
```
scope(exit) inside o
15 matches
Mail list logo