Re: writeln and write at CTFE

2021-01-13 Thread oddp via Digitalmars-d-learn
On 13.01.21 21:47, tsbockman via Digitalmars-d-learn wrote: Is CTFE I/O a standard feature in other languages? How many other languages even have a CTFE feature comparable to D's? Just two langs I use from time to time: 1) nim via forced ctfe; way faster than d by running through a vm: const

Re: Parameter with indetermined tuple elements type?

2021-01-11 Thread oddp via Digitalmars-d-learn
On 11.01.21 16:27, Marcone via Digitalmars-d-learn wrote: function [...] without template. And why don't you want to use templates for that? It's as easy as that: import std; auto foo(T)(T tup) if (isTuple!T) { // statically introspect tuple here ... return tup; } void main() {

Re: How can I directly reffer literal element itself inside [] slice?

2021-01-11 Thread oddp via Digitalmars-d-learn
On 11.01.21 16:45, Marcone via Digitalmars-d-learn wrote: "Hello World"[0..?.indexOf("o")] Does until [1] do the trick? "Hello World".until("o") // => "Hell" [1] https://dlang.org/library/std/algorithm/searching/until.html

Re: dirEntries: How get "." and ".."?

2021-01-10 Thread oddp via Digitalmars-d-learn
On 10.01.21 23:15, kdevel via Digitalmars-d-learn wrote: Don't you already know "." as the path you passed to dirEntries? I don't know the change date, the uid/gid etc. Not as sexy, but can't you manually construct DirEntries [1] by supplying the paths via std.path [2]? DirName [3] should

Re: DConf talk : Exceptions will disappear in the future?

2021-01-04 Thread oddp via Digitalmars-d-learn
On 04.01.21 16:39, ludo456 via Digitalmars-d-learn wrote: Can someone point me to an article or more explanations about that? already came up, see: https://forum.dlang.org/thread/jnrvugxqjzenykztt...@forum.dlang.org https://forum.dlang.org/thread/lhyagawrjzzmrtbok...@forum.dlang.org

Re: Reading files using delimiters/terminators

2020-12-27 Thread oddp via Digitalmars-d-learn
On 28.12.20 00:12, Rekel via Digitalmars-d-learn wrote: is there a reason to use either 'splitter' or 'split'? split gives you a newly allocated array with the results, splitter is lazy equivalent and doesn't allocate. Feel free using either, doesn't matter much with these small puzzle

Re: Reading files using delimiters/terminators

2020-12-27 Thread oddp via Digitalmars-d-learn
On 27.12.20 01:13, Rekel via Digitalmars-d-learn wrote: For context, I'm trying this with the puzzle input of day 6 of this year's advent of code. (https://adventofcode.com/) For that specific puzzle I simply did: foreach (group; readText("input").splitter("\n\n")) { ... } Since the input is

Re: low-latency GC

2020-12-08 Thread oddp via Digitalmars-d-learn
On 06.12.20 06:16, Bruce Carneal via Digitalmars-d-learn wrote: How difficult would it be to add a, selectable, low-latency GC to dlang? Is it closer to "we cant get there from here" or "no big deal if you already have the low-latency GC in hand"? I've heard Walter mention performance issues

Re: low-latency GC

2020-12-08 Thread oddp via Digitalmars-d-learn
On 06.12.20 06:16, Bruce Carneal via Digitalmars-d-learn wrote: How difficult would it be to add a, selectable, low-latency GC to dlang? Is it closer to "we cant get there from here" or "no big deal if you already have the low-latency GC in hand"? I've heard Walter mention performance issues

Re: Error: `std.uni.isUpper` conflicts with `std.ascii.isUpper`

2020-07-14 Thread oddp via Digitalmars-d-learn
On 2020-07-14 22:37, Marcone via Digitalmars-d-learn wrote: import std: isUpper, writeln; void main(){ writeln(isUpper('A')); } Why I get this error? How can I use isUpper()? Two more options: either fully qualify the name: import std; void main(){ writeln(std.uni.isUpper('A')); }

Re: Error: `std.uni.isUpper` conflicts with `std.ascii.isUpper`

2020-07-14 Thread oddp via Digitalmars-d-learn
On 2020-07-14 22:37, Marcone via Digitalmars-d-learn wrote: import std: isUpper, writeln; void main(){ writeln(isUpper('A')); } Why I get this error? How can I use isUpper()? Two more options: either fully qualify the name: import std; void main(){ writeln(std.uni.isUpper('A')); }