Re: Python : Pythonista / Ruby: Rubyist : / D : ?

2017-04-23 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 04/21/2017 01:20 PM, Vasudev Ram wrote: Hi list, I hope the question is self-evident from the message subject. If not, it means: what are D developers generally called (to indicate that they develop in D)? "Suave, awesome, ultra-attractive programmer with an impeccably fine taste in

[Issue 13742] undefined reference to __coverage

2017-04-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13742 Les De Ridder changed: What|Removed |Added CC||dl...@lesderid.net --

Re: Move construction from !is(T == typeof(this))

2017-04-23 Thread rikki cattermole via Digitalmars-d
There is[0] but idk how close it is to std:move and the likes. [0] http://dlang.org/phobos/std_algorithm_mutation.html#.move

Move construction from !is(T == typeof(this))

2017-04-23 Thread Manu via Digitalmars-d
Are there any known solutions to perform efficient move construction in D? D's pretty good at doing moves at all the right times, but with a serious limitation compared to C++ that the type must be an exact match. Consider this C++; really bad example, but just to illustrate: struct X {

Re: Default-valued nothrow @nogc std.conv:to

2017-04-23 Thread crimaniak via Digitalmars-d
On Saturday, 22 April 2017 at 12:14:26 UTC, Nordlöw wrote: Have anyone tried to implement a variant of `std.conv.to` that can be `nothrow @nogc` if the exception handling is replaced by an extra second parameter (`defaultValue`) returned iff the call to `to` throws? There is common ifThrown

Release dwtlib v1.01

2017-04-23 Thread JamesD via Digitalmars-d-dwt
dwtlib - DUB package for the D Widget Toolkit https://code.dlang.org/packages/dwtlib DWT is a library for creating cross-platform GUI applications. It's a port of the SWT Java library from Eclipse. *Status* WORKING Tested on: - Windows 10 Home - Ubuntu 16.04 LTS 32-bit - DMD32 v2.073.0 - DUB

[Issue 15371] __traits(getMember) should bypass the protection

2017-04-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15371 b2.t...@gmx.com changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|WONTFIX

[Issue 17096] many traits accept an invalid parameter count without error

2017-04-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17096 b2.t...@gmx.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

Re: DIP 1005 - Preliminary Review Round 1

2017-04-23 Thread Jon Degenhardt via Digitalmars-d
On Sunday, 23 April 2017 at 12:03:47 UTC, Andrei Alexandrescu wrote: On 4/22/17 4:52 PM, Joakim wrote: Why is this still up for review? Mostly out of a sense of conformity. We asked Michael to give no special treatment of DIPs originating from us, and this one was open, so he put it up for

Release dwtlib v1.0.1

2017-04-23 Thread JamesD via Digitalmars-d-announce
dwtlib - DUB package for the D Widget Toolkit https://code.dlang.org/packages/dwtlib DWT is a library for creating cross-platform GUI applications. It's a port of the SWT Java library from Eclipse. *Status* WORKING Tested on: - Windows 10 Home - Ubuntu 16.04 LTS 32-bit - DMD32 v2.073.0 - DUB

[Issue 17344] ICE with assignment of post inc-/decremented integral vector

2017-04-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17344 --- Comment #1 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/14df95ce47ba6e1fab63ae3b311ce3ff7841c206 fix Issue 17344 - ICE with assignment of post

[Issue 17339] ambiguous mangling with const alias argument

2017-04-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17339 --- Comment #3 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/da7e3bcabb4e9441391ecb5f2c9d3ea0b11cee7c fix Issue 17339 - ambiguous mangling with const alias

COM Expertise needed: COM Callbacks

2017-04-23 Thread Nierjerson via Digitalmars-d-learn
Still trying to get the com automation code working. This is a general issue with COM programming as I do not have the experience to solve the problem. There are two files at: http://s000.tinyupload.com/index.php?file_id=33201858563271816000 Gen.d is the automatically generated COM wrapper

[Issue 17345] [REG2.075.0] dirEntries link failure with -debug

2017-04-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17345 Vladimir Panteleev changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 17345] New: [REG2.075.0] dirEntries link failure with -debug

2017-04-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17345 Issue ID: 17345 Summary: [REG2.075.0] dirEntries link failure with -debug Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: link-failure

[Issue 17344] New: ICE with assignment of post inc-/decremented integral vector

2017-04-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17344 Issue ID: 17344 Summary: ICE with assignment of post inc-/decremented integral vector Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW

[Issue 17344] ICE with assignment of post inc-/decremented integral vector

2017-04-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17344 Martin Nowak changed: What|Removed |Added OS|Linux |All

Re: DIP 1005 - Preliminary Review Round 1

2017-04-23 Thread deadalnix via Digitalmars-d
On Sunday, 23 April 2017 at 19:25:09 UTC, Andrej Mitrovic wrote: With this syntax, the import is executed only if the declared name (process) is actually looked up. I don't believe the workaround with the `from` template fixes this. Not sure what DMD does, but SDC sure would do it only if

Re: using shared effectively in a producer/consumer situation.

2017-04-23 Thread Stanislav Blinov via Digitalmars-d-learn
On Sunday, 23 April 2017 at 20:33:48 UTC, Kevin Balbas wrote: I guess the follow up here is: Is this the correct way to do it? cast to shared, send to main thread, cast away shared? At the moment, pretty much yes. Either that or make the (unnecessary) immutable copies. There are no

Re: function type parameter inference not working

2017-04-23 Thread XavierAP via Digitalmars-d-learn
On Sunday, 23 April 2017 at 19:40:39 UTC, ag0aep6g wrote: Please post self-contained code. When I fill the gaps you left, it works for me: Interesting, thanks a lot. I'll test and narrow down what's in my code preventing this from working (I can't really think of anything) and I'll report

Re: Get name of current function

2017-04-23 Thread Stanislav Blinov via Digitalmars-d-learn
On Sunday, 23 April 2017 at 20:34:12 UTC, Mike B Johnson wrote: I'd like to get the symbolic name of the current function I'm in void foo() { writeln(thisFunc.stringof()); // prints foo } I need something short, elegant and doesn't require modifying preexisting code... I'm sure D has

Re: Get name of current function

2017-04-23 Thread cym13 via Digitalmars-d-learn
On Sunday, 23 April 2017 at 20:34:12 UTC, Mike B Johnson wrote: I'd like to get the symbolic name of the current function I'm in void foo() { writeln(thisFunc.stringof()); // prints foo } I need something short, elegant and doesn't require modifying preexisting code... I'm sure D has

Re: Get name of current function

2017-04-23 Thread Mike Wey via Digitalmars-d-learn
On 04/23/2017 10:34 PM, Mike B Johnson wrote: I'd like to get the symbolic name of the current function I'm in void foo() { writeln(thisFunc.stringof()); // prints foo } I need something short, elegant and doesn't require modifying preexisting code... I'm sure D has something along those

Get name of current function

2017-04-23 Thread Mike B Johnson via Digitalmars-d-learn
I'd like to get the symbolic name of the current function I'm in void foo() { writeln(thisFunc.stringof()); // prints foo } I need something short, elegant and doesn't require modifying preexisting code... I'm sure D has something along those lines?

Re: using shared effectively in a producer/consumer situation.

2017-04-23 Thread Kevin Balbas via Digitalmars-d-learn
On Sunday, 23 April 2017 at 20:30:33 UTC, Kevin Balbas wrote: I have an application where a long-lived "loader" thread takes messages to load data, loads that data, and then sends it back to the main thread via the standard concurrency primitives. Something like this: void threadFunc(Tid

using shared effectively in a producer/consumer situation.

2017-04-23 Thread Kevin Balbas via Digitalmars-d-learn
I have an application where a long-lived "loader" thread takes messages to load data, loads that data, and then sends it back to the main thread via the standard concurrency primitives. Something like this: void threadFunc(Tid ownerTid) { while(true) { receive(

Re: function type parameter inference not working

2017-04-23 Thread ag0aep6g via Digitalmars-d-learn
On 04/23/2017 09:33 PM, XavierAP wrote: void assembleMass1D(Mat, Vec)(ref Mat M, const ref Vec x) { /* ... */ } Matrix!(2,2) M = /* ... */; Vector!2 V = /* ... */; assembleMass1D(M, V); // ERROR template cannot deduce function from argument types Please post self-contained code. When I

function type parameter inference not working

2017-04-23 Thread XavierAP via Digitalmars-d-learn
It's not working for my case, while I see no special reason why it couldn't. Also I can't find specific inference rules at http://dlang.org/spec/function.html#function-templates Is it a problem that the types to be inferred are in turn also templated? Any workaround that can make inference

Re: DIP 1005 - Preliminary Review Round 1

2017-04-23 Thread Andrej Mitrovic via Digitalmars-d
On Sunday, 23 April 2017 at 16:39:35 UTC, deadalnix wrote: It's just one per module. Templates are only instantiated once per new set of arguments. There may be some gain here, but I doubt this is worth adding a new language feature. Ah, good point. Though there's still merit to this DIP

Re: multi-dimensional array whole slicing

2017-04-23 Thread XavierAP via Digitalmars-d-learn
On Sunday, 23 April 2017 at 09:06:35 UTC, Ali Çehreli wrote: It took me a while to convince myself that there is no bug here. The problem, as is obvious to others, ;) a whole slice of a whole slice is still the same slice. Ha, you're right, I hadn't realized. But I still have a problem.

Re: Python : Pythonista / Ruby: Rubyist : / D : ?

2017-04-23 Thread timmyjose via Digitalmars-d
On Saturday, 22 April 2017 at 08:30:03 UTC, Russel Winder wrote: Terms such as Pythonista, Rubyist, Rustacean, Gopher, etc. are terms of tribalism and exclusion. They are attempts to ensure people claiming membership of the tribe reject being polyglot by pressuring them to eschew all other

Re: Binding a udp socket to a port(on the local machine)

2017-04-23 Thread Jonathan Marler via Digitalmars-d-learn
On Saturday, 22 April 2017 at 21:24:33 UTC, Chainingsolid wrote: I couldn't figure out how to make a udp socket bound to a port of my choosing on the local machine, to use for listening for incoming connections. I assume you meant "incoming datagrams" and not "incoming connections". import

Re: Output-Range and char

2017-04-23 Thread Jonathan Marler via Digitalmars-d-learn
On Sunday, 23 April 2017 at 11:17:37 UTC, Mafi wrote: Hi there, every time I want to use output-ranges again they seem to be broken in a different way (e.g. value/reference semantics). This time it is char types and encoding. [...] Use sformat: import std.format, std.stdio; void main() {

Re: Python : Pythonista / Ruby: Rubyist : / D : ?

2017-04-23 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 04/23/2017 07:55 AM, Guillaume Piolat wrote: On Saturday, 22 April 2017 at 08:30:03 UTC, Russel Winder wrote: Terms such as Pythonista, Rubyist, Rustacean, Gopher, etc. are terms of tribalism and exclusion. They are attempts to ensure people claiming membership of the tribe reject being

Re: Address of UFCS call implicity converts to Delegate

2017-04-23 Thread Basile B. via Digitalmars-d
On Sunday, 23 April 2017 at 17:07:51 UTC, Jonathan Marler wrote: On Sunday, 23 April 2017 at 17:00:59 UTC, Basile B. wrote: 2/ Why not just a member function ? For the same reason that UFCS exists. You can't add "member functions" to external library types. Good point. I have to say that

Re: Address of UFCS call implicity converts to Delegate

2017-04-23 Thread Jonathan Marler via Digitalmars-d
On Sunday, 23 April 2017 at 17:00:59 UTC, Basile B. wrote: 2/ Why not just a member function ? For the same reason that UFCS exists. You can't add "member functions" to external library types.

Re: Address of UFCS call implicity converts to Delegate

2017-04-23 Thread Basile B. via Digitalmars-d
On Sunday, 23 April 2017 at 16:32:06 UTC, Jonathan Marler wrote: This feels like a natural extension to existing semantics. It doesn't require new syntax and serves as a solution to some issues when working with delegates. Say some API wants a delegate like this: void delegate(string arg)

Re: DIP 1005 - Preliminary Review Round 1

2017-04-23 Thread Arturg via Digitalmars-d
On Sunday, 23 April 2017 at 12:03:47 UTC, Andrei Alexandrescu wrote: On 4/22/17 4:52 PM, Joakim wrote: On Saturday, 22 April 2017 at 11:54:08 UTC, Mike Parker wrote: DIP 1005 is titled "Dependency-Carrying Declarations". https://github.com/dlang/DIPs/blob/master/DIPs/DIP1005.md All

Re: DIP 1005 - Preliminary Review Round 1

2017-04-23 Thread deadalnix via Digitalmars-d
On Saturday, 22 April 2017 at 11:54:08 UTC, Mike Parker wrote: Destroy! I'm not per se against going there but there are 2 points that needs to be considered. The first one is the "self important lookup" which obviate the need for this DIP to some extent. Second, if we are going to

Re: DIP 1005 - Preliminary Review Round 1

2017-04-23 Thread deadalnix via Digitalmars-d
On Sunday, 23 April 2017 at 12:34:34 UTC, Andrej Mitrovic wrote: On Sunday, 23 April 2017 at 12:03:47 UTC, Andrei Alexandrescu wrote: Mostly out of a sense of conformity. We asked Michael to give no special treatment of DIPs originating from us, and this one was open, so he put it up for

Address of UFCS call implicity converts to Delegate

2017-04-23 Thread Jonathan Marler via Digitalmars-d
This feels like a natural extension to existing semantics. It doesn't require new syntax and serves as a solution to some issues when working with delegates. Say some API wants a delegate like this: void delegate(string arg) With this feature, you could take a function like this: void

[OT] Re: DConf 2017 Berlin - bicycles

2017-04-23 Thread Bastiaan Veelo via Digitalmars-d
On Saturday, 22 April 2017 at 01:41:25 UTC, Walter Bright wrote: Many times I idly thought about rigging a sail on my bike. Not a bad idea: https://www.youtube.com/watch?v=AdfE4-hjrWA

[Issue 17289] With Xcode 8.3 linker, warnings of "pointer not aligned"

2017-04-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17289 --- Comment #7 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/5f5606429ca65fb81d550ab93b16835cb68a7c9c fix Issue 17289 - With Xcode 8.3 linker, warnings of 'pointer

[Issue 17289] With Xcode 8.3 linker, warnings of "pointer not aligned"

2017-04-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17289 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED

Re: Compare boost::hana to D

2017-04-23 Thread Steven Schveighoffer via Digitalmars-d
On 4/23/17 12:22 AM, Jesse Phillips wrote: On Friday, 21 April 2017 at 13:10:43 UTC, Adam D. Ruppe wrote: On Wednesday, 19 April 2017 at 18:02:46 UTC, Adrian Matoga wrote: [2] https://epi.github.io/2017/03/18/less_fun.html BTW in your D foreach, you could also have done `switch` void

[Issue 17218] foreach on tupleof inside switch returns ref to undefined address

2017-04-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17218 Steven Schveighoffer changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 16521] Wrong code generation with switch + static foreach

2017-04-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16521 --- Comment #10 from Steven Schveighoffer --- *** Issue 17218 has been marked as a duplicate of this issue. *** --

Re: Output-Range and char

2017-04-23 Thread Mafi via Digitalmars-d-learn
On Sunday, 23 April 2017 at 12:03:58 UTC, Ali Çehreli wrote: On 04/23/2017 04:17 AM, Mafi wrote: /opt/compilers/dmd2/include/std/range/primitives.d(351): Error: static assert "Cannot put a char into a char[]." Appender recommended: import std.format, std.stdio, std.array; void main() {

Re: DIP 1005 - Preliminary Review Round 1

2017-04-23 Thread Jacob Carlborg via Digitalmars-d
On 2017-04-23 14:03, Andrei Alexandrescu wrote: Mostly out of a sense of conformity. We asked Michael to give no special treatment of DIPs originating from us, and this one was open, so he put it up for review. It is likely it will end up rejected in favor of

Re: "Competitive Advantage with D" is one of the keynotes at C++Now 2017

2017-04-23 Thread Jacob Carlborg via Digitalmars-d-announce
On 2017-04-22 13:35, David Nadlinger wrote: LDC officially supports shared libraries on macOS. -David That's great. -- /Jacob Carlborg

Re: DIP 1005 - Preliminary Review Round 1

2017-04-23 Thread Andrej Mitrovic via Digitalmars-d
On Sunday, 23 April 2017 at 12:03:47 UTC, Andrei Alexandrescu wrote: Mostly out of a sense of conformity. We asked Michael to give no special treatment of DIPs originating from us, and this one was open, so he put it up for review. It is likely it will end up rejected in favor of

Re: "Competitive Advantage with D" is one of the keynotes at C++Now 2017

2017-04-23 Thread Guillaume Piolat via Digitalmars-d-announce
On Sunday, 23 April 2017 at 12:04:08 UTC, Guillaume Piolat wrote: Hence Rust that sanctified this style. And why it's not that interesting to the modern C++ programmer.

Re: "Competitive Advantage with D" is one of the keynotes at C++Now 2017

2017-04-23 Thread Guillaume Piolat via Digitalmars-d-announce
On Sunday, 23 April 2017 at 10:16:14 UTC, Walter Bright wrote: On 4/11/2017 8:10 AM, Guillaume Piolat wrote: Newer C++ almost erased leaks and memory errors if you follow it. C and C++ don't have memory leaks if you are careful. The trouble is, there's no checking. The rules of leak-free,

Re: DIP 1005 - Preliminary Review Round 1

2017-04-23 Thread Andrei Alexandrescu via Digitalmars-d
On 4/22/17 4:52 PM, Joakim wrote: On Saturday, 22 April 2017 at 11:54:08 UTC, Mike Parker wrote: DIP 1005 is titled "Dependency-Carrying Declarations". https://github.com/dlang/DIPs/blob/master/DIPs/DIP1005.md All review-related feedback on and discussion of the DIP should occur in this

Re: Output-Range and char

2017-04-23 Thread Ali Çehreli via Digitalmars-d-learn
On 04/23/2017 04:17 AM, Mafi wrote: /opt/compilers/dmd2/include/std/range/primitives.d(351): Error: static assert "Cannot put a char into a char[]." Appender recommended: import std.format, std.stdio, std.array; void main() { auto sink = appender!(char[])(); formattedWrite(sink,

Re: Python : Pythonista / Ruby: Rubyist : / D : ?

2017-04-23 Thread Guillaume Piolat via Digitalmars-d
On Saturday, 22 April 2017 at 08:30:03 UTC, Russel Winder wrote: Terms such as Pythonista, Rubyist, Rustacean, Gopher, etc. are terms of tribalism and exclusion. They are attempts to ensure people claiming membership of the tribe reject being polyglot by pressuring them to eschew all other

LDC 1.2.0 has been released!

2017-04-23 Thread Kai Nacke via Digitalmars-d-announce
Hi everyone, LDC 1.2.0, the LLVM-based D compiler, is available for download! This release is based on the 2.072.2 frontend and standard library and supports LLVM 3.5-4.0. We provide binaries for Linux, OX X, FreeBSD, Win32 & Win64, now bundled with DUB. :-) As usual, you can find links to

Output-Range and char

2017-04-23 Thread Mafi via Digitalmars-d-learn
Hi there, every time I want to use output-ranges again they seem to be broken in a different way (e.g. value/reference semantics). This time it is char types and encoding. How do I make formattedWrite work with a char buffer? I tried the following code and it fails with a *static assert*; it

Re: Python : Pythonista / Ruby: Rubyist : / D : ?

2017-04-23 Thread Idan Arye via Digitalmars-d
On Saturday, 22 April 2017 at 08:30:03 UTC, Russel Winder wrote: Terms such as Pythonista, Rubyist, Rustacean, Gopher, etc. are terms of tribalism and exclusion. They are attempts to ensure people claiming membership of the tribe reject being polyglot by pressuring them to eschew all other

Re: [OT] do we have lint for bash?

2017-04-23 Thread Vladimir Panteleev via Digitalmars-d
On Sunday, 23 April 2017 at 10:07:30 UTC, cym13 wrote: On Sunday, 23 April 2017 at 09:51:36 UTC, Kagamin wrote: https://abload.de/img/tmpliy6q.png I guess you're looking for something like http://www.shellcheck.net/ However I don't see how an automated tool could have found the error in

Re: "Competitive Advantage with D" is one of the keynotes at C++Now 2017

2017-04-23 Thread Walter Bright via Digitalmars-d-announce
On 4/11/2017 8:10 AM, Guillaume Piolat wrote: Newer C++ almost erased leaks and memory errors if you follow it. C and C++ don't have memory leaks if you are careful. The trouble is, there's no checking.

Re: [OT] do we have lint for bash?

2017-04-23 Thread cym13 via Digitalmars-d
On Sunday, 23 April 2017 at 09:51:36 UTC, Kagamin wrote: https://abload.de/img/tmpliy6q.png I guess you're looking for something like http://www.shellcheck.net/ However I don't see how an automated tool could have found the error in your screenshot as passing multiple arguments to rm is a

[OT] do we have lint for bash?

2017-04-23 Thread Kagamin via Digitalmars-d
https://abload.de/img/tmpliy6q.png

[Issue 17343] class.init. does not working

2017-04-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17343 --- Comment #2 from Andrey --- ok got it. --

[Issue 17343] class.init. does not working

2017-04-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17343 ag0ae...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED CC|

[Issue 17343] New: class.init. does not working

2017-04-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17343 Issue ID: 17343 Summary: class.init. does not working Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority:

Re: multi-dimensional array whole slicing

2017-04-23 Thread Ali Çehreli via Digitalmars-d-learn
On 04/22/2017 01:51 PM, XavierAP wrote: > I can do: > > int[3] arr = void; > arr[] = 1; > > But apparently I can't do: > > int[3][4] arr = void; > arr[][] = 1; > > What is the best way? What am I missing? It took me a while to convince myself that there is no bug here. The problem, as is

Re: multi-dimensional array whole slicing

2017-04-23 Thread XavierAP via Digitalmars-d-learn
On Saturday, 22 April 2017 at 22:25:58 UTC, kinke wrote: int[3][4] arr = void; (cast(int[]) arr)[] = 1; assert(arr[3][2] == 1); Thanks... I think I prefer to write two loops though :p I wish D built-in arrays supported [,] indexing notation like C# (or as you can do in D for custom types)

template auto switch_(Any& a) { return [](auto ...cases_) { auto cases = hana::make_tuple(cases_...); auto default_ = hana::find_if(cases, [](auto const& c) { return hana:

2017-04-23 Thread Amit yadav via Digitalmars-d
template auto switch_(Any& a) { return [](auto ...cases_) { auto cases = hana::make_tuple(cases_...); auto default_ = hana::find_if(cases, [](auto const& c) { return hana::first(c) == hana::type_c; }); // ... }; }