Re: Function parameters UDAs

2018-11-14 Thread Radu via Digitalmars-d-learn
On Wednesday, 14 November 2018 at 18:05:55 UTC, Adam D. Ruppe wrote: On Wednesday, 14 November 2018 at 16:28:19 UTC, Radu wrote: Looks like that there is no easy way to extract a function parameters UDA list. Indeed, the only way I can find is kinda crazy: --- void foo(int f, @("test")

Re: Windows Service

2018-11-14 Thread Thomas via Digitalmars-d-learn
On Thursday, 15 November 2018 at 04:45:26 UTC, Soulsbane wrote: On Wednesday, 14 November 2018 at 19:38:08 UTC, Thomas wrote: Hi, I want to run a D program as a Windows service. After googl'in, I only found a very old project on github: https://github.com/tylerjensen/WindowsServiceInD

Vibe throw link error

2018-11-14 Thread greatsam4sure via Digitalmars-d-learn
Vibe.d 0.8.4 throw link error with dmd-2.08.0 and newer on windows 10. What is the what out. In dub package register, it was said that vibe 0.8.4 works with dmd 2.08.0 and old version but in my case it does not work looking forward for help

Re: Windows Service

2018-11-14 Thread Soulsbane via Digitalmars-d-learn
On Wednesday, 14 November 2018 at 19:38:08 UTC, Thomas wrote: Hi, I want to run a D program as a Windows service. After googl'in, I only found a very old project on github: https://github.com/tylerjensen/WindowsServiceInD Unfortunately, I wasn't able to compile it successfully. Does anybody

Re: Could not setup D extension on vs code

2018-11-14 Thread greatsam4sure via Digitalmars-d-learn
On Wednesday, 14 November 2018 at 19:28:44 UTC, WebFreak001 wrote: On Wednesday, 14 November 2018 at 13:20:31 UTC, greatsam4sure wrote: [...] Hi, thanks for the report, I tagged a new version of workspace-d which will fix this issue. Simply reload vscode and let it rebuild to fix. Issue

Re: Could not setup D extension on vs code

2018-11-14 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 14 November 2018 at 20:44:26 UTC, Neia Neutuladh wrote: On Wed, 14 Nov 2018 19:28:44 +, WebFreak001 wrote: It's a real pain that you can't select specific commits in dub, but I try to keep up with the updates and make them work somehow. Yeah, I've used submodules and

Re: Could not setup D extension on vs code

2018-11-14 Thread Neia Neutuladh via Digitalmars-d-learn
On Wed, 14 Nov 2018 19:28:44 +, WebFreak001 wrote: > It's a real pain that you can't select specific commits in dub, but I > try to keep up with the updates and make them work somehow. Yeah, I've used submodules and path-based dependencies once or twice because of that. It's not the best.

Windows Service

2018-11-14 Thread Thomas via Digitalmars-d-learn
Hi, I want to run a D program as a Windows service. After googl'in, I only found a very old project on github: https://github.com/tylerjensen/WindowsServiceInD Unfortunately, I wasn't able to compile it successfully. Does anybody know of newer approaches or even a template to start from?

Re: Could not setup D extension on vs code

2018-11-14 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 14 November 2018 at 13:20:31 UTC, greatsam4sure wrote: What is the solution to this: Unresolvable dependencies to package libdparse: dfmt ~master depends on libdparse ~>0.10.7 libddoc 0.4.0 depends on libdparse ~>0.9.0 Failed to install serve-d (Error code 2) Where can i

Re: Function parameters UDAs

2018-11-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 14 November 2018 at 16:28:19 UTC, Radu wrote: Looks like that there is no easy way to extract a function parameters UDA list. Indeed, the only way I can find is kinda crazy: --- void foo(int f, @("test") string s) {} void main() { static if(is(typeof(foo) Params ==

Re: passing subclass to superclass where parameter is a delegate for the superclass

2018-11-14 Thread Alex via Digitalmars-d-learn
On Wednesday, 14 November 2018 at 16:39:52 UTC, Alex wrote: Are you looking for this? https://dlang.org/phobos/std_traits.html#TransitiveBaseTypeTuple It matches however not exactly your needs: As all objects are derived from the Object class, you will always get it as the common parent.

Re: passing subclass to superclass where parameter is a delegate for the superclass

2018-11-14 Thread Alex via Digitalmars-d-learn
On Wednesday, 14 November 2018 at 16:06:21 UTC, Chris Bare wrote: If I have: class base { void delegate(base) stored_dg; void add_function (void delegate (base) dlg) { stored_dg = dlg; } } class A : base { this () { super (); add_function ();

Function parameters UDAs

2018-11-14 Thread Radu via Digitalmars-d-learn
Looks like that there is no easy way to extract a function parameters UDA list. The following: ``` import std.traits; struct s { string foo; } void foo(@s("aaa") int a, bool x); void main() { alias P = Parameters!foo; enum udas = __traits(getAttributes, P); pragma(msg, udas); }

passing subclass to superclass where parameter is a delegate for the superclass

2018-11-14 Thread Chris Bare via Digitalmars-d-learn
If I have: class base { void delegate(base) stored_dg; void add_function (void delegate (base) dlg) { stored_dg = dlg; } } class A : base { this () { super (); add_function (); } void foo (A a) { log ("i got here"); }

Could not setup D extension on vs code

2018-11-14 Thread greatsam4sure via Digitalmars-d-learn
What is the solution to this: Unresolvable dependencies to package libdparse: dfmt ~master depends on libdparse ~>0.10.7 libddoc 0.4.0 depends on libdparse ~>0.9.0 Failed to install serve-d (Error code 2) Where can i download libdparse 0.10.7 The full error file below. i am on windows 10

Re: Differences between group() and chunkBy()

2018-11-14 Thread Dennis via Digitalmars-d-learn
On Wednesday, 14 November 2018 at 12:28:38 UTC, Per Nordlöw wrote: Is it because of `group` has a default for the predicate whereas `chunkBy` hasn't. chunkBy splits the range into smaller ranges, group actually returns tuples of the item and the amount of occurences. Because in group the

Differences between group() and chunkBy()

2018-11-14 Thread Per Nordlöw via Digitalmars-d-learn
Why is there at https://dlang.org/phobos/std_algorithm_iteration.html an inconsistency in naming of `group` and chunkBy`? Is it because of `group` has a default for the predicate whereas `chunkBy` hasn't. Further, why aren't the two merged into a single iteration algorithm?

Re: Problem with opBinary

2018-11-14 Thread realhet via Digitalmars-d-learn
Thanks, this make it clear. (This also explains the existence of opBinaryRight)

Re: Problem with opBinary

2018-11-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 14, 2018 2:54:27 AM MST realhet via Digitalmars-d- learn wrote: > Hi, > > Just a little weird thing I noticed and don't know why it is: > > I have a FilePath struct and I wanted to make it work with the > "~" operator and an additional string. > > So I've created a global

Problem with opBinary

2018-11-14 Thread realhet via Digitalmars-d-learn
Hi, Just a little weird thing I noticed and don't know why it is: I have a FilePath struct and I wanted to make it work with the "~" operator and an additional string. So I've created a global funct: FilePath opBinary(string op:"~")(FilePath p1, string p2){ return FilePath(p1, p2);

Re: Is there any way for non-blocking IO with phobos?

2018-11-14 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 13 November 2018 at 13:52:57 UTC, Sobaya wrote: But I don't know how many lines are sent from the server for an input, so readln function blocks. Read lines in another thread and send them to the main thread with std.concurrency.