Re: D create many thread

2020-02-06 Thread bauss via Digitalmars-d-learn
On Thursday, 6 February 2020 at 22:00:26 UTC, tchaloupka wrote: On Wednesday, 5 February 2020 at 13:05:59 UTC, Eko Wahyudin wrote: Hi all, I'm create a small (hallo world) application, with DMD. But my program create 7 annoying threads when create an empty class. If you don't want the

Re: D create many thread

2020-02-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/02/2020 8:53 AM, uranuz wrote: Is it also possible to set some custom thread name for GC threads in order to be distinguishable from other threads in utilities like `htop`? It would be handy... https://dlang.org/phobos/core_thread_osthread.html#.Thread.name.2

Re: How to converte string to wstring[]?

2020-02-06 Thread novice2 via Digitalmars-d-learn
import std.conv: to; string str = "test1"; wstring[] wstr = [to!wstring(str)];

Re: D create many thread

2020-02-06 Thread tchaloupka via Digitalmars-d-learn
On Wednesday, 5 February 2020 at 13:05:59 UTC, Eko Wahyudin wrote: Hi all, I'm create a small (hallo world) application, with DMD. But my program create 7 annoying threads when create an empty class. If you don't want the parallel sweep enabled for your app, you can turn it of ie with:

Re: How to converte string to wstring[]?

2020-02-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 6 February 2020 at 21:53:08 UTC, Marcone wrote: How to converte "string" to wstring[] in Dlang? You don't, generally. A string can be converted to a wstring, but a wstring[] is a very different thing. import std.conv; wstring s = to!wstring(some_string); note that works for

How to converte string to wstring[]?

2020-02-06 Thread Marcone via Digitalmars-d-learn
How to converte "string" to wstring[] in Dlang?

Re: D create many thread

2020-02-06 Thread uranuz via Digitalmars-d-learn
Is it also possible to set some custom thread name for GC threads in order to be distinguishable from other threads in utilities like `htop`? It would be handy...

Re: Trying to use a template class with ranges

2020-02-06 Thread mark via Digitalmars-d-learn
On Thursday, 6 February 2020 at 16:29:57 UTC, Steven Schveighoffer wrote: On 2/6/20 11:05 AM, mark wrote: src/package.d(50,35): Error: no property opCall for type diffrange.Diff!(dchar[]), did you mean new Diff!(dchar[])? Hah, forgot that it's a class. Yes, I DID mean new Diff ;) -Steve

Re: Trying to use a template class with ranges

2020-02-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/6/20 11:05 AM, mark wrote: src/package.d(50,35): Error: no property opCall for type diffrange.Diff!(dchar[]), did you mean new Diff!(dchar[])? Hah, forgot that it's a class. Yes, I DID mean new Diff ;) -Steve

Re: Trying to use a template class with ranges

2020-02-06 Thread mark via Digitalmars-d-learn
On Thursday, 6 February 2020 at 15:21:46 UTC, Steven Schveighoffer wrote: [snip] 3. You should declare constraints signifying what types are valid. i.e.: class Diff(T) if ( isForwardRange!T // it's a forward range && is(typeof(T.init.front == T.init.front)) // elements are comparable

Re: Object "A" inherited object "B". And you need to return the object link "B".

2020-02-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/6/20 10:11 AM, Steven Schveighoffer wrote b.step(); // virtual call, calls B.step I meant, calls A.step; -Steve

Re: Trying to use a template class with ranges

2020-02-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/6/20 7:16 AM, mark wrote: I am starting on porting Python's difflib's sequence matcher to D. I want to have a class that will accept two ranges whose elements are of the same type and whose elements can be compared for equality. How do I make a class declaration that specifies a

Re: Object "A" inherited object "B". And you need to return the object link "B".

2020-02-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/6/20 8:05 AM, Mihail Lorenko wrote: On Thursday, 6 February 2020 at 12:37:01 UTC, Adam D. Ruppe wrote: On Thursday, 6 February 2020 at 12:15:17 UTC, Mihail Lorenko wrote:     B* b; A pointer to a class is a rare thing in B since they are already automatic references. Just use `B b;`

Re: const pointers C vs. D

2020-02-06 Thread Johann Lermer via Digitalmars-d-learn
On Tuesday, 4 February 2020 at 10:17:39 UTC, Dennis wrote: C++ has a const system that is closer to D's than any other language, but it still has huge differences: Thanks, that clears it up a bit!

Re: Trying to use a template class with ranges

2020-02-06 Thread mark via Digitalmars-d-learn
I forgot to mention: I want the class to work with: Diff(aForwardRange, bForwardRange) where T = ForwardRange, E = anything that supports == A common use case is for two sequences of strings (i.e., lines read from two files). Diff(aString, bString) where T = char[] or wchar[] or dchar[] E =

Re: Object "A" inherited object "B". And you need to return the object link "B".

2020-02-06 Thread Mihail Lorenko via Digitalmars-d-learn
On Thursday, 6 February 2020 at 12:37:01 UTC, Adam D. Ruppe wrote: On Thursday, 6 February 2020 at 12:15:17 UTC, Mihail Lorenko wrote: B* b; A pointer to a class is a rare thing in B since they are already automatic references. Just use `B b;` and ten `b = a` will just work. Thanks

Re: Object "A" inherited object "B". And you need to return the object link "B".

2020-02-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 6 February 2020 at 12:15:17 UTC, Mihail Lorenko wrote: B* b; A pointer to a class is a rare thing in B since they are already automatic references. Just use `B b;` and ten `b = a` will just work.

Object "A" inherited object "B". And you need to return the object link "B".

2020-02-06 Thread Mihail Lorenko via Digitalmars-d-learn
Hello! Interested in a question. Object "A" inherited object "B". And you need to return the object link "B". Is this possible in this language? Here is an example: class B { protected int a; public void step() {}; } class A : B { public override step() { import

Trying to use a template class with ranges

2020-02-06 Thread mark via Digitalmars-d-learn
I am starting on porting Python's difflib's sequence matcher to D. I want to have a class that will accept two ranges whose elements are of the same type and whose elements can be compared for equality. How do I make a class declaration that specifies a (forward) range type and an

Detecting unneeded imports in CI

2020-02-06 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
Hello folks, Are there any well-established CI patterns/tools for detecting unneeded imports in D code? Ideally including detecting unused symbols from selective imports? Thanks and best wishes, -- Joe

Re: Dub - vibe.d - hunt framework ... problems

2020-02-06 Thread Gregor Mückl via Digitalmars-d-learn
On Saturday, 1 February 2020 at 10:35:52 UTC, seany wrote: Hi I want to start a small server, that will be accessible form outside. Not a huge deal right? Not quite. My machine: 4.15.0-66-generic #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux DMD : DMD64 D

Re: Dub - vibe.d - hunt framework ... problems

2020-02-06 Thread zoujiaqing via Digitalmars-d-learn
On Saturday, 1 February 2020 at 10:35:52 UTC, seany wrote: Hi I want to start a small server, that will be accessible form outside. Not a huge deal right? Not quite. My machine: 4.15.0-66-generic #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux DMD : DMD64 D