Re: Deduct and return class type

2021-01-22 Thread Виталий Фадеев via Digitalmars-d-learn
On Saturday, 23 January 2021 at 05:54:09 UTC, Виталий Фадеев wrote: On Saturday, 23 January 2021 at 05:39:18 UTC, Виталий Фадеев wrote: Context: data + GUI List Goal: auto list = new List( data ); I want 'this( T )( T data )' deduction: class A( T ) { this( T )( T

Re: which free operating systems have a gtkd package?

2021-01-22 Thread rikki cattermole via Digitalmars-d-learn
https://d-apt.sourceforge.io/ Or you could use dub and not worry about where its installed. https://github.com/gtkd-developers/GtkD/wiki/Hello-World-Example-on-Ubuntu-19.10-(Linux)

which free operating systems have a gtkd package?

2021-01-22 Thread dan via Digitalmars-d-learn
Debian 10 has a nice gtkd package, stored in libgtkd-3-dev i believe (when i installed it, i installed several packages at once, basically everything that had 'gtkd' as a substring in the package name). It uses ldmd2 (part of the ldc package). So it's possible to write and build a gtkd

Re: Deduct and return class type

2021-01-22 Thread tsbockman via Digitalmars-d-learn
On Saturday, 23 January 2021 at 05:54:09 UTC, Виталий Фадеев wrote: auto listFactory( T )( T data ) { return new List!( T )( data ); } This is the correct way to do it in D; it's annoying, I know. (Personally, I usually shorten `listFactory` to just `list` to make the

Re: Deduct and return class type

2021-01-22 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 23 January 2021 at 05:54:09 UTC, Виталий Фадеев wrote: But, how to create class instance with type deduction in usual way ? auto list = new List( extensions ); You can't; there's no type deduction for constructors.

Re: Deduct and return class type

2021-01-22 Thread Виталий Фадеев via Digitalmars-d-learn
On Saturday, 23 January 2021 at 05:39:18 UTC, Виталий Фадеев wrote: Context: data + GUI List Goal: auto list = new List( data ); Of course, we can use 'factory': import std.stdio; template List( alias T ) { class List { T data;

Deduct and return class type

2021-01-22 Thread Виталий Фадеев via Digitalmars-d-learn
Context: data + GUI List Goal: auto list = new List( data ); Concept: class is created in the usual way : new List( data ) store inside the class: T data; type T deducted : ( T )( T data ) Tried way: template List( T ) { class

Re: std.algorithm.splitter on a string not always bidirectional

2021-01-22 Thread H. S. Teoh via Digitalmars-d-learn
On Friday, 22 January 2021 at 17:29:08 UTC, Steven Schveighoffer wrote: On 1/22/21 11:57 AM, Jon Degenhardt wrote: [...] Another way to look at it: If split (eager) took a predicate, that 'xyz.splitter(args).back' and 'xyz.split(args).back' should produce the same result. But they will not

Re: std.algorithm.splitter on a string not always bidirectional

2021-01-22 Thread Jon Degenhardt via Digitalmars-d-learn
On Friday, 22 January 2021 at 17:29:08 UTC, Steven Schveighoffer wrote: On 1/22/21 11:57 AM, Jon Degenhardt wrote: I think the idea is that if a construct like 'xyz.splitter(args)' produces a range with the sequence of elements {"a", "bc", "def"}, then 'xyz.splitter(args).back' should

Re: std.algorithm.splitter on a string not always bidirectional

2021-01-22 Thread Imperatorn via Digitalmars-d-learn
On Friday, 22 January 2021 at 17:29:08 UTC, Steven Schveighoffer wrote: On 1/22/21 11:57 AM, Jon Degenhardt wrote: [...] But that is possible with all 3 splitter variants. Why is one allowed to be bidirectional and the others are not? [...] +1

Re: std.algorithm.splitter on a string not always bidirectional

2021-01-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/22/21 11:57 AM, Jon Degenhardt wrote: I think the idea is that if a construct like 'xyz.splitter(args)' produces a range with the sequence of elements {"a", "bc", "def"}, then 'xyz.splitter(args).back' should produce "def". But, if finding the split points starting from the back results

Re: std.algorithm.splitter on a string not always bidirectional

2021-01-22 Thread Jon Degenhardt via Digitalmars-d-learn
On Friday, 22 January 2021 at 14:14:50 UTC, Steven Schveighoffer wrote: On 1/22/21 12:55 AM, Jon Degenhardt wrote: On Friday, 22 January 2021 at 05:51:38 UTC, Jon Degenhardt wrote: On Thursday, 21 January 2021 at 22:43:37 UTC, Steven Schveighoffer wrote: auto sp1 = "a|b|c".splitter('|');

Re: Dub seems to be using an earlier version of the dependency that I tell it to use

2021-01-22 Thread vnr via Digitalmars-d-learn
On Friday, 22 January 2021 at 15:57:00 UTC, Steven Schveighoffer wrote: On 1/22/21 10:34 AM, vnr wrote: [...] It just needs a tag. delimited (for example) added here: https://github.com/DmitryOlshansky/pry-parser/commit/808d01c30b50a928f5795dab7e6c0a7a392899b0 May of 2017, Last tag was

Re: Dub seems to be using an earlier version of the dependency that I tell it to use

2021-01-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/22/21 10:34 AM, vnr wrote: Hello  I'm trying to use the combinator Pry parser library (https://code.dlang.org/packages/pry/0.3.2), but, as I'll explain in the rest of this message, it seems to be a bad version of the lib that dub downloads me. So, simply by adding pry as a dependency

Dub seems to be using an earlier version of the dependency that I tell it to use

2021-01-22 Thread vnr via Digitalmars-d-learn
Hello  I'm trying to use the combinator Pry parser library (https://code.dlang.org/packages/pry/0.3.2), but, as I'll explain in the rest of this message, it seems to be a bad version of the lib that dub downloads me. So, simply by adding pry as a dependency on a virgin project, and using

Re: std.algorithm.splitter on a string not always bidirectional

2021-01-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/22/21 12:55 AM, Jon Degenhardt wrote: On Friday, 22 January 2021 at 05:51:38 UTC, Jon Degenhardt wrote: On Thursday, 21 January 2021 at 22:43:37 UTC, Steven Schveighoffer wrote: auto sp1 = "a|b|c".splitter('|'); writeln(sp1.back); // ok auto sp2 = "a.b|c".splitter!(v => !isAlphaNum(v));

Re: Issue with socket recieve

2021-01-22 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 20 January 2021 at 21:31:54 UTC, Tim wrote: Hi all, I'm having a really terrible bug that seemed to come from nowhere and is really hard to narrow down. You may be hitting this issue: https://issues.dlang.org/show_bug.cgi?id=7349 FWIW, popped onto the radar in the most recent

Re: Issue with socket recieve

2021-01-22 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 21 January 2021 at 03:30:50 UTC, Tim wrote: On Thursday, 21 January 2021 at 03:21:41 UTC, Adam D. Ruppe wrote: On Wednesday, 20 January 2021 at 21:31:54 UTC, Tim wrote: [...] [snip] generate a core.exception.InvalidMemoryOperationError that I can't catch. None of this makes