On Thursday, 18 February 2021 at 17:27:48 UTC, Steven
Schveighoffer wrote:
readln will block. eof doesn't tell you that there is no data
in the pipe, it just says whether the pipe has been closed.
Of course, I must have been thinking of another language - I
should take a coffee before postin
if someone happens to be looking to do that in the future: I
didn't find a way to do this with a linker but managed to find a
way to do this with code only. The code goes like this:
// source: https://stackoverflow.com/a/10444161/800123
#include
// NOTE: It is recommended that you delay-load
On Wednesday, 17 February 2021 at 04:10:24 UTC, tsbockman wrote:
I spent some time experimenting with this problem, and here is
the best solution I found, assuming that perfect de-duplication
is required. (I'll put the code up on GitHub / dub if anyone
wants to have a look.)
It would be inter
On Thursday, 18 February 2021 at 08:29:48 UTC, kinke wrote:
Nope, Paul is right, the copy ctors don't solve anything in
this regard. Simplest example I could come up with:
https://run.dlang.io/is/TgxyU3
I found that example very confusing, as it does not contain an
explicit copy constructor,
On Thursday, 18 February 2021 at 20:47:33 UTC, Mike Brown wrote:
Is slices comparable to a string_view?
My c++ is rusty af but yes I think so.
A d slice is `struct slice { size_t length; T* ptr; }` so when in
doubt just think back to what that does.
string lex_identifier(ref string input)
Hi All,
I'm rebuilding a C++, and the beginning section is a lexer that
uses strings, and string_view.
Is slices comparable to a string_view?
The architecture of the lexer is a single layer (Non-)FSM Lexer.
Basically a main loop, checking the first letter of the current
input position, whic
On 2/18/21 4:40 AM, frame wrote:
On Thursday, 18 February 2021 at 06:04:13 UTC, Jedi wrote:
Unfortunately, std.process wraps all the pipes in File structs, so
you have almost no good mechanisms to properly read the data.
WTF?
It's just the way it is. Everything in Phobos is a C FILE * (wra
On 2/17/21 4:16 PM, Adam D. Ruppe wrote:
On Wednesday, 17 February 2021 at 20:48:22 UTC, Martin wrote:
is this how it supposed to be? (https://run.dlang.io/is/7B4irm)
== compares contents. Both null and "" have empty contents and are
interchangable for operators that work on contents.
The a
On Thursday, 18 February 2021 at 15:11:44 UTC, Paul Backus wrote:
On Thursday, 18 February 2021 at 14:51:09 UTC, vitamin wrote:
On Thursday, 18 February 2021 at 14:43:43 UTC, Paul Backus
wrote:
I don't see what this buys you compared to sticking with one
or the other, but you are correct that
On Thursday, 18 February 2021 at 14:51:09 UTC, vitamin wrote:
On Thursday, 18 February 2021 at 14:43:43 UTC, Paul Backus
wrote:
I don't see what this buys you compared to sticking with one
or the other, but you are correct that it is technically
possible.
It infer function atributes (pure,
On Thursday, 18 February 2021 at 13:53:19 UTC, Paul Backus wrote:
Another possibility is to use discriminated unions and
tag-based dispatch (i.e., switch statements) instead of classes
and virtual method dispatch. This would make it a bit harder to
follow the book, but might be a better learnin
On Thursday, 18 February 2021 at 11:00:50 UTC, vitamin wrote:
opPostMove
https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1014.md can solve this problem but it isn't implemented;
IIRC opPostMove has been abandoned for the same reason postblits
were abandoned (issues with type-check
On Thursday, 18 February 2021 at 14:43:43 UTC, Paul Backus wrote:
On Thursday, 18 February 2021 at 14:26:37 UTC, vitamin wrote:
Or combination of discriminate uninons and classes:
/+dub.sdl:
dependency "sumtype" version="~>0.10.0"
+/
import std.stdio;
import sumtype;
alias Expression = SumTy
On Thursday, 18 February 2021 at 14:26:37 UTC, vitamin wrote:
Or combination of discriminate uninons and classes:
/+dub.sdl:
dependency "sumtype" version="~>0.10.0"
+/
import std.stdio;
import sumtype;
alias Expression = SumType!(
ExprValue,
ExprBinary,
ExprUnary
);
class Expr{
On Thursday, 18 February 2021 at 13:53:19 UTC, Paul Backus wrote:
On Thursday, 18 February 2021 at 11:14:05 UTC, Mina wrote:
I'm following along with the crafting interpreters book
(https://craftinginterpreters.com) and it goes into
implementing a visitor pattern that returns generic types, so
On Thursday, 18 February 2021 at 11:14:05 UTC, Mina wrote:
I'm following along with the crafting interpreters book
(https://craftinginterpreters.com) and it goes into
implementing a visitor pattern that returns generic types, so
implementing it in D came down to the accept method causing
undef
I'm following along with the crafting interpreters book
(https://craftinginterpreters.com) and it goes into implementing
a visitor pattern that returns generic types, so implementing it
in D came down to the accept method causing undefined symbol
error that goes away when changing it to returni
On Thursday, 18 February 2021 at 08:29:48 UTC, kinke wrote:
On Wednesday, 17 February 2021 at 20:44:46 UTC, tsbockman wrote:
On Wednesday, 17 February 2021 at 20:18:53 UTC, Paul Backus
wrote:
[...]
That bug is about postblits, this(this), not copy
constructors: this(ref typeof(this)). Copy c
On Thursday, 18 February 2021 at 06:04:13 UTC, Jedi wrote:
Unfortunately, std.process wraps all the pipes in File
structs, so you have almost no good mechanisms to properly
read the data.
WTF?
-Steve
I'm wonder about this message. You can always use readln() and
eof() on such kind of st
On Wednesday, 17 February 2021 at 20:44:46 UTC, tsbockman wrote:
On Wednesday, 17 February 2021 at 20:18:53 UTC, Paul Backus
wrote:
On Wednesday, 17 February 2021 at 19:42:00 UTC, tsbockman
wrote:
A copy constructor and opAssign can be used to update
pointers that are relative to &this:
ht
20 matches
Mail list logo