Re: write a function template specialisation that tests if an argument is known at compile time

2018-08-11 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 12 August 2018 at 02:17:21 UTC, Cecil Ward wrote: I was thinking about reflection and powerful things like traits. Would a test to see if a static if compile do the trick ? You ask the question using traits : "does the following compile? : { static if ( mask == 3 ) { }; }" - any use

Re: dmd64 on Windows: how?

2018-08-11 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 11 August 2018 at 19:50:30 UTC, Ivan Kazmenko wrote: n This was most close to solving my problem. Thanks! I've installed the components shown in wiki image: v141 tools and the SDKs. VS 2017 Community includes everything you need. There's no reason to install the SDK separately

Re: Could you anybody using DerelictSDL2 on Android?

2018-08-11 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 11 August 2018 at 14:36:59 UTC, zhani wrote: On Saturday, 11 August 2018 at 08:47:59 UTC, Mike Parker wrote: On Tuesday, 7 August 2018 at 12:05:33 UTC, zhani wrote: [...] I don't do any sort of Android development, so I've never tested any Derelict packages on the platform. A fe

Re: Could you anybody using DerelictSDL2 on Android?

2018-08-11 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 11 August 2018 at 15:46:47 UTC, tide wrote: extern(C) is a feature, Derelict are libraries. https://dlang.org/spec/interfaceToC.html You can use Derelict "static" to the same effect I think, but they way they achieve it doesn't play well with auto completion and such. All of t

Re: write a function template specialisation that tests if an argument is known at compile time

2018-08-11 Thread Cecil Ward via Digitalmars-d-learn
On Sunday, 12 August 2018 at 02:17:21 UTC, Cecil Ward wrote: On Sunday, 12 August 2018 at 00:55:50 UTC, Paul Backus wrote: On Sunday, 12 August 2018 at 00:15:37 UTC, Cecil Ward wrote: Paul, what would the calls look like? I am about to misunderstand things completely so here goes :-) It would

Re: write a function template specialisation that tests if an argument is known at compile time

2018-08-11 Thread Cecil Ward via Digitalmars-d-learn
On Sunday, 12 August 2018 at 00:55:50 UTC, Paul Backus wrote: On Sunday, 12 August 2018 at 00:15:37 UTC, Cecil Ward wrote: Paul, what would the calls look like? I am about to misunderstand things completely so here goes :-) It would be a bit kludgy having to switch from one calling syntax to

Re: @nogc with opApply

2018-08-11 Thread ag0aep6g via Digitalmars-d-learn
On 08/11/2018 12:00 PM, Alex wrote: ´´´ import std.experimental.all; static assert(isIterable!S); [...] struct S { [...]     int opApply(scope int delegate(ref uint) /*@nogc*/ operations) //@nogc     { [...]     } } ´´´ Everything works fine, before I try to use the opApply function

Re: unimplemented abstract function compiles.

2018-08-11 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 11 August 2018 at 23:12:43 UTC, ag0aep6g wrote: On 08/11/2018 11:20 PM, rikki cattermole wrote: On 12/08/2018 8:55 AM, Eric wrote: Code below compiles while I would not expect it to compile. Is there a reason that this compiles? [...] No bug. You forgot to throw -unittest when yo

Re: @nogc with opApply

2018-08-11 Thread tide via Digitalmars-d-learn
On Saturday, 11 August 2018 at 10:00:34 UTC, Alex wrote: Hi all, maybe I misunderstand something but having this: ´´´ import std.experimental.all; static assert(isIterable!S); void main() { S s; s.each!(el => el.writeln); } struct S { private Nullable!uint member = 0; Nullable

Re: write a function template specialisation that tests if an argument is known at compile time

2018-08-11 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 12 August 2018 at 00:15:37 UTC, Cecil Ward wrote: Paul, what would the calls look like? I am about to misunderstand things completely so here goes :-) It would be a bit kludgy having to switch from one calling syntax to another, putting the mask argument in the template parameters

Re: write a function template specialisation that tests if an argument is known at compile time

2018-08-11 Thread Cecil Ward via Digitalmars-d-learn
On Saturday, 11 August 2018 at 18:11:15 UTC, Paul Backus wrote: On Saturday, 11 August 2018 at 05:17:51 UTC, Cecil Ward wrote: T myfunc(T)( T x, uint mask ) if ( mask == 3 ) { return fast_func( x, mask ); } but of course this doesn't work because mask is not known at compile-time.

Re: unimplemented abstract function compiles.

2018-08-11 Thread ag0aep6g via Digitalmars-d-learn
On 08/11/2018 10:55 PM, Eric wrote: Code below compiles while I would not expect it to compile. Is there a reason that this compiles? [...] class I {   abstract void f(); } class C : I { } unittest {   C c = cast(C) Object.factory("C");   c.f(); } Not a bug, as far as I see. You don't

Re: unimplemented abstract function compiles.

2018-08-11 Thread rikki cattermole via Digitalmars-d-learn
On 12/08/2018 11:12 AM, ag0aep6g wrote: On 08/11/2018 11:20 PM, rikki cattermole wrote: On 12/08/2018 8:55 AM, Eric wrote: Code below compiles while I would not expect it to compile. Is there a reason that this compiles? [...] No bug. You forgot to throw -unittest when you compiled. [...] E

Re: unimplemented abstract function compiles.

2018-08-11 Thread ag0aep6g via Digitalmars-d-learn
On 08/11/2018 11:20 PM, rikki cattermole wrote: On 12/08/2018 8:55 AM, Eric wrote: Code below compiles while I would not expect it to compile. Is there a reason that this compiles? [...] No bug. You forgot to throw -unittest when you compiled. [...] Error: program killed by signal 11 If th

Re: unimplemented abstract function compiles.

2018-08-11 Thread rikki cattermole via Digitalmars-d-learn
On 12/08/2018 8:55 AM, Eric wrote: Code below compiles while I would not expect it to compile. Is there a reason that this compiles? Specs are a bit lite on abstract classes. Only thing I found that would need to allow this is: "19.4 functions without bodies" https://dlang.org/spec/function.htm

unimplemented abstract function compiles.

2018-08-11 Thread Eric via Digitalmars-d-learn
Code below compiles while I would not expect it to compile. Is there a reason that this compiles? Specs are a bit lite on abstract classes. Only thing I found that would need to allow this is: "19.4 functions without bodies" https://dlang.org/spec/function.html#function-declarations But that's

Re: dmd64 on Windows: how?

2018-08-11 Thread Ivan Kazmenko via Digitalmars-d-learn
Well, I tried all your suggestions. (Actually re-tried a few times.) Thanks, Laurent and Kagamin! On Friday, 10 August 2018 at 14:47:04 UTC, Laurent Tréguier wrote: Did you have a look at the wiki ? It looks like the image shows what needs to be installed: https://wiki.dlang.org/Installing_DMD#

Re: write a function template specialisation that tests if an argument is known at compile time

2018-08-11 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 11 August 2018 at 05:17:51 UTC, Cecil Ward wrote: T myfunc(T)( T x, uint mask ) if ( mask == 3 ) { return fast_func( x, mask ); } but of course this doesn't work because mask is not known at compile-time. so I wondered if there is a way to do something like static if (

Re: Could you anybody using DerelictSDL2 on Android?

2018-08-11 Thread tide via Digitalmars-d-learn
On Saturday, 11 August 2018 at 14:44:49 UTC, zhani wrote: On Saturday, 11 August 2018 at 14:03:21 UTC, tide wrote: On Tuesday, 7 August 2018 at 12:05:33 UTC, zhani wrote: howdy :-) can anybody use sdl2 on android? first, i got a ldc2 for android. i just followed here on windows: https://wik

Re: dtoh

2018-08-11 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-08-06 15:28, Laeeth Isharc wrote: Hi Walter. Can dtoh be open-sourced now that dmd is? If you mean htod, I would instead recommend DStep [1] or dpp [2]. Both of them are using libclang for parsing C/C++ code. DStep is cross-platform. [1] http://github.com/jacob-carlborg/dstep [2] ht

Re: Could you anybody using DerelictSDL2 on Android?

2018-08-11 Thread zhani via Digitalmars-d-learn
On Saturday, 11 August 2018 at 14:03:21 UTC, tide wrote: On Tuesday, 7 August 2018 at 12:05:33 UTC, zhani wrote: howdy :-) can anybody use sdl2 on android? first, i got a ldc2 for android. i just followed here on windows: https://wiki.dlang.org/Build_D_for_Android#Windows so i could compile

Re: Could you anybody using DerelictSDL2 on Android?

2018-08-11 Thread zhani via Digitalmars-d-learn
On Saturday, 11 August 2018 at 08:47:59 UTC, Mike Parker wrote: On Tuesday, 7 August 2018 at 12:05:33 UTC, zhani wrote: [...] I don't do any sort of Android development, so I've never tested any Derelict packages on the platform. A few years back someone did some work with the DerelictGLES b

Re: Could you anybody using DerelictSDL2 on Android?

2018-08-11 Thread tide via Digitalmars-d-learn
On Tuesday, 7 August 2018 at 12:05:33 UTC, zhani wrote: howdy :-) can anybody use sdl2 on android? first, i got a ldc2 for android. i just followed here on windows: https://wiki.dlang.org/Build_D_for_Android#Windows so i could compile a sieve.d but didnt run it on android yet. then next? wu

@nogc with opApply

2018-08-11 Thread Alex via Digitalmars-d-learn
Hi all, maybe I misunderstand something but having this: ´´´ import std.experimental.all; static assert(isIterable!S); void main() { S s; s.each!(el => el.writeln); } struct S { private Nullable!uint member = 0; Nullable!uint front() @nogc { return member; } //void popFront

Re: How to proceed with learning to code Windows desktop applications?

2018-08-11 Thread I Lindström via Digitalmars-d-learn
On Wednesday, 31 January 2018 at 12:56:31 UTC, Arredondo wrote: As other have said, WPF and C# is the way to go for Windows GUI programming, but you don't necessarily need to drop D. You could write your interface code in VS and have it call your D library via pinvoke (Platform Invoke). To ma

Re: Could you anybody using DerelictSDL2 on Android?

2018-08-11 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 7 August 2018 at 12:05:33 UTC, zhani wrote: howdy :-) can anybody use sdl2 on android? first, i got a ldc2 for android. i just followed here on windows: https://wiki.dlang.org/Build_D_for_Android#Windows so i could compile a sieve.d but didnt run it on android yet. then next? wu