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 16:06:33 UTC, Alexandru Ermicioi
wrote:
3. An edge case. Ex: You need to mutate some data and then
assume it is immutable in a constructor.
Can you give a valid example where that is necessary? The main
examples that I can think of either can be `@safe` with the rig
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:44:48 UTC, someone wrote:
https://en.wikipedia.org/wiki/Luhn_algorithm#Pseudocode_implementation
That specific function, in Phobos? no.
sum modulo 10? That's just some_var%10 in D.
The Wikipedia link ends with a link to RosettaCode:
https://rosettacode.org/wiki
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
https://en.wikipedia.org/wiki/Luhn_algorithm#Pseudocode_implementation
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
On Friday, 2 July 2021 at 22:08:31 UTC, tsbockman wrote:
(Responding out of order:)
On Friday, 2 July 2021 at 00:26:52 UTC, someone wrote:
But when you start attempting to declare @safe chunks of code
that actually DO things ... well, it seems end-of-the-story.
If you find yourself unable to
On Saturday, 3 July 2021 at 09:28:32 UTC, user1234 wrote:
On Saturday, 3 July 2021 at 09:05:28 UTC, vnr wrote:
Hello,
I am trying to make a small generic lexer that bases its token
analysis on regular expressions. The principle I have in mind
is to define a token type table with its correspon
On Saturday, 3 July 2021 at 09:05:28 UTC, vnr wrote:
Hello,
I am trying to make a small generic lexer that bases its token
analysis on regular expressions. The principle I have in mind
is to define a token type table with its corresponding regular
expression, here is the code I currently have
Hello,
I am trying to make a small generic lexer that bases its token
analysis on regular expressions. The principle I have in mind is
to define a token type table with its corresponding regular
expression, here is the code I currently have:
```d
import std.regex;
/// ditto
struct Token
{
17 matches
Mail list logo