Re: A DUB Case Study: Compiling DMD as a Library

2017-12-19 Thread Venkat via Digitalmars-d-learn
This is regarding the latest D blog post. Jacob Carlborg is here, so I figured I'd post it. https://dlang.org/blog/2017/08/01/a-dub-case-study-compiling-dmd-as-a-library/#comment-2922 Simply changing the targetType from library to dynamicLibrary breaks the code. What is going on with it ?

Re: Using DLLs to extend an existing class

2017-12-19 Thread rikki cattermole via Digitalmars-d-learn
I am afraid to say this has quite a simple answer. TypeInfo (and with that vtables used as part of classes), do not cross the dll boundary (other platforms things mostly work). Which means, can't do what you are wanting I'm afraid. It is an implementation issue that we REALLY REALLY REALLY

Re: tuples from text file

2017-12-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/19/17 7:47 PM, codephantom wrote: so I have a text file containing 3 lines(e.g): 5, "hello", 4.3 "hello", 4.3 "hello", "world", 1, 2, 3, 5.5 Now I want to create tuples from each line. However, (using line 1 as example), I get: Tuple!string("5, \"hello\", 4.3") but I really want:

tuples from text file

2017-12-19 Thread codephantom via Digitalmars-d-learn
so I have a text file containing 3 lines(e.g): 5, "hello", 4.3 "hello", 4.3 "hello", "world", 1, 2, 3, 5.5 Now I want to create tuples from each line. However, (using line 1 as example), I get: Tuple!string("5, \"hello\", 4.3") but I really want: Tuple!(int, string, double)(5, "hello", 4.3)

Re: Alias example should supposedly be illegal, but runs fine

2017-12-19 Thread Mike Franklin via Digitalmars-d-learn
On Tuesday, 19 December 2017 at 10:37:05 UTC, Michael wrote: On Tuesday, 19 December 2017 at 02:12:29 UTC, Mike Franklin wrote: On Tuesday, 19 December 2017 at 02:04:34 UTC, codephantom wrote: writeln(S.j); // Error: Instance symbols cannot be used through types. I don't understand why

Using DLLs to extend an existing class

2017-12-19 Thread Sebastian Trent via Digitalmars-d-learn
I'm developing a plugin system for a D program. I have a complex class hierarchy which will be complied into our executable, and I want third parties to be able to further extend it with their own DLLs - subject to implementing an API present in the most derived class - which will be provided

Re: How do I pass a type as parameter in this method?

2017-12-19 Thread Marc via Digitalmars-d-learn
On Tuesday, 19 December 2017 at 15:52:57 UTC, Dgame wrote: On Tuesday, 19 December 2017 at 15:19:53 UTC, Marc wrote: [...] template FirstOf(T...) { template otherwise(D) { static if (T.length == 0) { enum otherwise = D.init; } else { enum otherwise

Re: No of threads

2017-12-19 Thread Ali Çehreli via Digitalmars-d-learn
On 12/19/2017 02:24 AM, Vino wrote: > Hi All, > >Request your help in clarifying the below. As per the document > > foreach (d; taskPool.parallel(xxx)) : The total number of threads that > will be created is total CPU -1 ( 2 processor with 6 core : 11 threads) > > foreach (d;

Re: Write native GUI applications for Windows

2017-12-19 Thread thedeemon via Digitalmars-d-learn
On Monday, 18 December 2017 at 07:55:25 UTC, Andrey wrote: I have a question about creating native GUI applications for Windows 7 or/and Windows 10. And what about D? What should I do? Make some kind of wrapper above C WinApi? I've used DFL which is a thin wrapper over WinAPI and its native

Re: How do I pass a type as parameter in this method?

2017-12-19 Thread Dgame via Digitalmars-d-learn
On Tuesday, 19 December 2017 at 15:19:53 UTC, Marc wrote: On Tuesday, 19 December 2017 at 00:01:00 UTC, Ali Çehreli wrote: On 12/18/2017 03:54 PM, Ali Çehreli wrote: On 12/18/2017 02:58 PM, Marc wrote: Here's another experiment: template FirstOf(T...) { template otherwise(D) {

Re: ptr wrapper with dip1000

2017-12-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/19/17 8:22 AM, vit wrote: struct Ptr{     int* ptr;     static Ptr create(scope return int* ptr)@safe{     Ptr x;     x.ptr = ptr;     return x;     }     /++ This doesn't work:     this(scope return int* ptr)scope @safe{     this.ptr = ptr;     }     +/ }

Re: How do I pass a type as parameter in this method?

2017-12-19 Thread Marc via Digitalmars-d-learn
On Tuesday, 19 December 2017 at 00:01:00 UTC, Ali Çehreli wrote: On 12/18/2017 03:54 PM, Ali Çehreli wrote: On 12/18/2017 02:58 PM, Marc wrote: Here's another experiment: template FirstOf(T...) { template otherwise(D) { static if (T.length == 0) { enum otherwise =

ptr wrapper with dip1000

2017-12-19 Thread vit via Digitalmars-d-learn
How to manualy declare constructor for struct Ptr which work like Ptr.create? struct Ptr{ int* ptr; static Ptr create(scope return int* ptr)@safe{ Ptr x; x.ptr = ptr; return x; } /++ This doesn't work: this(scope return int* ptr)scope @safe{

Re: No of threads

2017-12-19 Thread Vino via Digitalmars-d-learn
On Tuesday, 19 December 2017 at 11:03:27 UTC, codephantom wrote: On Tuesday, 19 December 2017 at 10:24:47 UTC, Vino wrote: foreach (d; taskPool.parallel(xxx,20)) : As in Windows 2008 whatever value is set for the parallel the total number of threads does not increase more than 12. So not

Re: No of threads

2017-12-19 Thread rikki cattermole via Digitalmars-d-learn
On 19/12/2017 11:03 AM, codephantom wrote: On Tuesday, 19 December 2017 at 10:24:47 UTC, Vino wrote: foreach (d; taskPool.parallel(xxx,20)) : As in Windows 2008 whatever value is set for the parallel the total number of threads does not increase more than 12. So not sure if this is

Re: No of threads

2017-12-19 Thread codephantom via Digitalmars-d-learn
On Tuesday, 19 December 2017 at 10:24:47 UTC, Vino wrote: foreach (d; taskPool.parallel(xxx,20)) : As in Windows 2008 whatever value is set for the parallel the total number of threads does not increase more than 12. So not sure if this is correct, so can any one explain me on same.

Re: Alias example should supposedly be illegal, but runs fine

2017-12-19 Thread Michael via Digitalmars-d-learn
On Tuesday, 19 December 2017 at 02:12:29 UTC, Mike Franklin wrote: On Tuesday, 19 December 2017 at 02:04:34 UTC, codephantom wrote: writeln(S.j); // Error: Instance symbols cannot be used through types. I don't understand why you would say that is a bug. I meant that the example is

Re: Fold in Parallelism

2017-12-19 Thread Vino via Digitalmars-d-learn
On Monday, 18 December 2017 at 20:53:28 UTC, Russel Winder wrote: Ali, Shouldn't this be a pull request for std.parallelism to be extended? If the function is in std.algorithm, then people should not have to write it for themselves in std.parallelism. On Mon, 2017-12-18 at 11:01 -0800,

Re: Alias example should supposedly be illegal, but runs fine

2017-12-19 Thread Michael via Digitalmars-d-learn
On Tuesday, 19 December 2017 at 01:29:04 UTC, Meta wrote: On Monday, 18 December 2017 at 23:44:46 UTC, Michael wrote: [...] I think the reason that this works is because i is static, meaning that you don't need the `this` reference of S to access it and thus it can be aliased. Declaring a

No of threads

2017-12-19 Thread Vino via Digitalmars-d-learn
Hi All, Request your help in clarifying the below. As per the document foreach (d; taskPool.parallel(xxx)) : The total number of threads that will be created is total CPU -1 ( 2 processor with 6 core : 11 threads) foreach (d; taskPool.parallel(xxx,1)) : The total number of threads that

Re: Dub project has both .sdl and .json files. Is this normal or did I do something wrong?

2017-12-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-12-18 23:36, WhatMeWorry wrote: I've been using Dub for a while but from the very beginning I decided to go with SDL 100% of the time, So I've got a dub.sdl file like: name "01_10_camera_view_space" description "A minimal D application." authors "kheaser" copyright "Copyright © 2017,

Re: Dub project has both .sdl and .json files. Is this normal or did I do something wrong?

2017-12-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-12-18 23:57, WebFreak001 wrote: dub.selections.json is basically broken design The design is fine, not so sure about the implementation. I've explain many time before why it's necessary. -- /Jacob Carlborg