Re: Virtual Classes?

2016-08-17 Thread Basile B. via Digitalmars-d-learn
On Thursday, 18 August 2016 at 03:58:00 UTC, Meta wrote: On Thursday, 18 August 2016 at 02:55:49 UTC, Basile B. wrote: On Thursday, 18 August 2016 at 02:51:48 UTC, Meta wrote: On Thursday, 18 August 2016 at 00:49:49 UTC, Engine Machine wrote: https://en.wikipedia.org/wiki/Virtual_class Can D

Re: DerelictGL3.reload with specified path question.

2016-08-17 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 18 August 2016 at 03:54:24 UTC, WhatMeWorry wrote: When I saw the .dll in OpenGL.dll, I immediately thought: just Windows. But does this hold true for the linux shared opengl libraries as well? Is this why DerelictGL3.reload() does not take a path argument. But then why

Re: Virtual Classes?

2016-08-17 Thread Meta via Digitalmars-d-learn
On Thursday, 18 August 2016 at 02:55:49 UTC, Basile B. wrote: On Thursday, 18 August 2016 at 02:51:48 UTC, Meta wrote: On Thursday, 18 August 2016 at 00:49:49 UTC, Engine Machine wrote: https://en.wikipedia.org/wiki/Virtual_class Can D do stuff like this naturally? Yes, D's `alias this`

Re: DerelictGL3.reload with specified path question.

2016-08-17 Thread WhatMeWorry via Digitalmars-d-learn
On Thursday, 18 August 2016 at 03:11:17 UTC, WhatMeWorry wrote: On Wednesday, 17 August 2016 at 23:21:59 UTC, Rene Zwanenburg wrote: On Wednesday, 17 August 2016 at 22:59:31 UTC, WhatMeWorry wrote: I want to store all my shared/dynamic libraries within a special directory relative to where the

Re: DerelictGL3.reload with specified path question.

2016-08-17 Thread WhatMeWorry via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 23:21:59 UTC, Rene Zwanenburg wrote: On Wednesday, 17 August 2016 at 22:59:31 UTC, WhatMeWorry wrote: I want to store all my shared/dynamic libraries within a special directory relative to where the application directory is. All of the derelictXX.loads(path)

Re: Virtual Classes?

2016-08-17 Thread Basile B. via Digitalmars-d-learn
On Thursday, 18 August 2016 at 02:51:48 UTC, Meta wrote: On Thursday, 18 August 2016 at 00:49:49 UTC, Engine Machine wrote: https://en.wikipedia.org/wiki/Virtual_class Can D do stuff like this naturally? Yes, D's `alias this` feature supports this.

Re: Virtual Classes?

2016-08-17 Thread Meta via Digitalmars-d-learn
On Thursday, 18 August 2016 at 00:49:49 UTC, Engine Machine wrote: https://en.wikipedia.org/wiki/Virtual_class Can D do stuff like this naturally? Yes, D's `alias this` feature supports this. https://dlang.org/spec/class.html#alias-this

Re: Virtual Classes?

2016-08-17 Thread Basile B. via Digitalmars-d-learn
On Thursday, 18 August 2016 at 00:49:49 UTC, Engine Machine wrote: https://en.wikipedia.org/wiki/Virtual_class Can D do stuff like this naturally? Not naturally. The ancestor must be specified for the inner "virtual class": °°° class Foo { class Internal

compile error while use `extern(C++, class)`

2016-08-17 Thread mogu via Digitalmars-d-learn
From spec (Interfacing to C++) https://dlang.org/spec/cpp_interface.html: ``` When mapping a D class onto a C++ struct, use extern(C++, struct) to avoid linking problems with C++ compilers (notably MSVC) that distinguish between C++'s class and struct when mangling. Conversely, use

Virtual Classes?

2016-08-17 Thread Engine Machine via Digitalmars-d-learn
https://en.wikipedia.org/wiki/Virtual_class Can D do stuff like this naturally?

Re: DerelictGL3.reload with specified path question.

2016-08-17 Thread Rene Zwanenburg via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 22:59:31 UTC, WhatMeWorry wrote: I want to store all my shared/dynamic libraries within a special directory relative to where the application directory is. All of the derelictXX.loads(path) compiles except DerelictGL3.reload(lib); which doesn't seem to be

Re: Sequence separation

2016-08-17 Thread ag0aep6g via Digitalmars-d-learn
On 08/17/2016 09:21 PM, Lodovico Giaretta wrote: import std.traits: TemplateOf; static if (__traits(isSame, TemplateOf!(x.args[2]), MySequence)) { ... } std.traits.TemplateOf extracts the symbol representing the uninstantiated template. __traits(isSame, symbol1, symbol2) evaluates at

Re: Sequence separation

2016-08-17 Thread Engine Machine via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 19:15:48 UTC, ag0aep6g wrote: On 08/17/2016 08:38 PM, Engine Machine wrote: [...] [...] [...] With MySequence being a type, you can do this: static if (is(x.args[2] == MySequence!Args, Args ...)) { ... } It works! Nifty that you can do that

Re: Sequence separation

2016-08-17 Thread Engine Machine via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 19:21:57 UTC, Lodovico Giaretta wrote: On Wednesday, 17 August 2016 at 19:15:48 UTC, ag0aep6g wrote: [...] import std.traits: TemplateOf; static if (__traits(isSame, TemplateOf!(x.args[2]), MySequence)) { ... } std.traits.TemplateOf extracts the symbol

Re: Sequence separation

2016-08-17 Thread Engine Machine via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 18:38:48 UTC, Engine Machine wrote: On Wednesday, 17 August 2016 at 08:37:32 UTC, Lodovico Giaretta wrote: On Tuesday, 16 August 2016 at 23:18:28 UTC, Adam D. Ruppe wrote: [...] You mean something like: struct MySequence(Args...) { enum length =

Re: Sequence separation

2016-08-17 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 19:15:48 UTC, ag0aep6g wrote: On 08/17/2016 08:38 PM, Engine Machine wrote: On Wednesday, 17 August 2016 at 08:37:32 UTC, Lodovico Giaretta wrote: [...] You mean something like: struct MySequence(Args...) { enum length = Args.length; alias args = Args;

Re: Sequence separation

2016-08-17 Thread ag0aep6g via Digitalmars-d-learn
On 08/17/2016 08:38 PM, Engine Machine wrote: On Wednesday, 17 August 2016 at 08:37:32 UTC, Lodovico Giaretta wrote: [...] You mean something like: struct MySequence(Args...) { enum length = Args.length; alias args = Args; } alias x = MySequence!(a, b, MySequence!(c, d)); static

Re: Sequence separation

2016-08-17 Thread Engine Machine via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 08:37:32 UTC, Lodovico Giaretta wrote: On Tuesday, 16 August 2016 at 23:18:28 UTC, Adam D. Ruppe wrote: On Tuesday, 16 August 2016 at 19:17:27 UTC, Engine Machine wrote: alias x = AliasSeq!(a, b, AliasSeq!(c, d)); results in a flat sequence. I would like to be

Re: having a trivial anonymous function call in template prevents compilation?

2016-08-17 Thread Cauterite via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 13:33:26 UTC, Steven Schveighoffer wrote: I think the OP's case is a bug. Please file. Thanks, I've filed it. Just wanted to get a second opinion before concluding that it's a bug.

Re: having a trivial anonymous function call in template prevents compilation?

2016-08-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/17/16 9:23 AM, Lodovico Giaretta wrote: On Wednesday, 17 August 2016 at 13:21:16 UTC, Cauterite wrote: On Wednesday, 17 August 2016 at 13:18:06 UTC, Adam D. Ruppe wrote: Best you can do is use them in an alias argument directly, but you cannot use them in an enum argument. I think you

Re: having a trivial anonymous function call in template prevents compilation?

2016-08-17 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 13:21:16 UTC, Cauterite wrote: On Wednesday, 17 August 2016 at 13:18:06 UTC, Adam D. Ruppe wrote: Best you can do is use them in an alias argument directly, but you cannot use them in an enum argument. I think you missed the point; it works perfectly fine

Re: having a trivial anonymous function call in template prevents compilation?

2016-08-17 Thread Cauterite via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 13:18:06 UTC, Adam D. Ruppe wrote: Best you can do is use them in an alias argument directly, but you cannot use them in an enum argument. I think you missed the point; it works perfectly fine without having this `({return 0;})()` in the template body (which,

Re: having a trivial anonymous function call in template prevents compilation?

2016-08-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 13:09:40 UTC, Cauterite wrote: Just by having a random `({return 0;})()` in the template body, suddenly the template rejects its arguments. I'm so confused, is this a bug? Or am I missing something? Function pointers and delegates are not valid compile time

having a trivial anonymous function call in template prevents compilation?

2016-08-17 Thread Cauterite via Digitalmars-d-learn
// -- Example: -- template A(alias Arg) { enum A = Arg; enum Unrelated = ({return 0;})(); // this line prevent compilation }; void main() { enum FnPtr = enum _ = A!FnPtr; }; void asdf() {}; // ( https://dpaste.dzfl.pl/79301f12e5fc ) Just by having a

Re: typeof.stringof wrong type

2016-08-17 Thread Eugene Wissner via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 12:39:18 UTC, ag0aep6g wrote: On 08/17/2016 02:08 PM, Eugene Wissner wrote: I have a problem, that .stringof doesn't return what I'm expecting. Consider the following: template A(string T) { enum A : bool { yes = true, } } void main() {

Re: typeof.stringof wrong type

2016-08-17 Thread ag0aep6g via Digitalmars-d-learn
On 08/17/2016 02:08 PM, Eugene Wissner wrote: I have a problem, that .stringof doesn't return what I'm expecting. Consider the following: template A(string T) { enum A : bool { yes = true, } } void main() { A!"asdf" a1; typeof(a1) a2; mixin(typeof(a1).stringof ~

typeof.stringof wrong type

2016-08-17 Thread Eugene Wissner via Digitalmars-d-learn
I have a problem, that .stringof doesn't return what I'm expecting. Consider the following: template A(string T) { enum A : bool { yes = true, } } void main() { A!"asdf" a1; typeof(a1) a2; mixin(typeof(a1).stringof ~ " a3;"); } I

Re: Log in an @nogc function

2016-08-17 Thread Saurabh Das via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 10:47:54 UTC, Guillaume Piolat wrote: On Wednesday, 17 August 2016 at 10:45:01 UTC, Saurabh Das wrote: Is there any way I can log to a terminal or a file from inside an @nogc function? Thanks, Saurabh import core.stdc.stdio; printf("am logging C-style\n");

Re: ARSD PNG memory usage

2016-08-17 Thread Guillaume Piolat via Digitalmars-d-learn
On Tuesday, 16 August 2016 at 16:40:30 UTC, Adam D. Ruppe wrote: On Tuesday, 16 August 2016 at 16:29:18 UTC, Guillaume Piolat wrote: Hey, I also stumbled upon this with imageformats decoding PNG. Image loading makes 10x the garbage it should. Let's see what this threads unveils... leet me

Re: Log in an @nogc function

2016-08-17 Thread Guillaume Piolat via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 10:45:01 UTC, Saurabh Das wrote: Is there any way I can log to a terminal or a file from inside an @nogc function? Thanks, Saurabh import core.stdc.stdio; printf("am logging C-style\n");

Log in an @nogc function

2016-08-17 Thread Saurabh Das via Digitalmars-d-learn
Is there any way I can log to a terminal or a file from inside an @nogc function? Thanks, Saurabh

Re: Sequence separation

2016-08-17 Thread Lodovico Giaretta via Digitalmars-d-learn
On Tuesday, 16 August 2016 at 23:18:28 UTC, Adam D. Ruppe wrote: On Tuesday, 16 August 2016 at 19:17:27 UTC, Engine Machine wrote: alias x = AliasSeq!(a, b, AliasSeq!(c, d)); results in a flat sequence. I would like to be able to keep them separate so I can have sub sequences. wrap them in

Re: Command Line Utility Library

2016-08-17 Thread UDW via Digitalmars-d-learn
On Tuesday, 16 August 2016 at 07:19:18 UTC, Edwin van Leeuwen wrote: I am using: http://code.dlang.org/packages/docopt It's not really json configurable, but that shouldn't be to complex to implement yourself. That's also very nice. I hadn't thought of writing the help text first and then