Re: Overloads not returning appropriate info. [Field reflunkory]

2019-04-09 Thread Adam D. Ruppe via Digitalmars-d-learn
Another couple ideas you might get some traction on are making typeid() values be convertible back into typeof types iff CTFE. That would let you use types as OOP class values in intermediate structures while still turning them back into template args later. Not sure just how realistic that

Re: Overloads not returning appropriate info. [Field reflunkory]

2019-04-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 9 April 2019 at 21:00:55 UTC, H. S. Teoh wrote: (And on a side note: don't even get me started on is(...) expressions.) is expressions rock. And I betcha if we did do libraries for them, it would eventually go full circle, with someone doing a pattern-matching DSL that reinvents

Re: Overloads not returning appropriate info. [Field reflunkory]

2019-04-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 9 April 2019 at 20:45:18 UTC, Alex wrote: On Tuesday, 9 April 2019 at 18:33:21 UTC, Seb wrote: Have you considered writing a DIP? No, because I expect it won't even be considered. You won't pass review if you don't show knowledge of the existing language, but there's a lot of

Re: Templates - What's Up with the template keyword?

2019-04-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 10 April 2019 at 00:42:11 UTC, Ali Çehreli wrote: (It may be made to work with Adam's (T : Point!R, R) syntax but I failed just now.) You know, I didn't think T : Point!T would work, but it does. Huh. Anyway, the , R one works similarly, observe: --- T getResponse(T : Point!R,

Re: Templates - What's Up with the template keyword?

2019-04-09 Thread Ali Çehreli via Digitalmars-d-learn
On 04/08/2019 05:59 AM, Ron Tarrant wrote: On Monday, 8 April 2019 at 12:40:10 UTC, Adam D. Ruppe wrote: You don't need template keyword for the majority of cases because the compiler lets you do shortcuts. Thanks, Adam. Good to know. (maybe I am looking at the wrong part of the book, it is

Re: Templates - What's Up with the template keyword?

2019-04-09 Thread Ali Çehreli via Digitalmars-d-learn
On 04/08/2019 05:23 AM, Ron Tarrant wrote: > But in "Programming in D," (self, 2009-2018) by Ali Çehreli, there's no > mention of the 'template' keyword in any of his examples. 'template' keyword is introduced here: http://ddili.org/ders/d.en/templates_more.html#ix_templates_more.template I

Re: Templates - What's Up with the template keyword?

2019-04-09 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Apr 09, 2019 at 04:48:45PM -0400, Steven Schveighoffer via Digitalmars-d-learn wrote: > On 4/9/19 4:31 PM, Ron Tarrant wrote: > > > I'm still struggling to understand templates, but I'll keep at it. [...] > The thing that made it click for me is that a template is very akin to > a macro

Re: Overloads not returning appropriate info. [Field reflunkory]

2019-04-09 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Apr 09, 2019 at 08:49:17PM +, Alex via Digitalmars-d-learn wrote: > On Tuesday, 9 April 2019 at 18:56:58 UTC, H. S. Teoh wrote: [...] > My point has been and is that there is a better way that is more > natural. I make no claims about anything else. It may be a cop out to > say

Re: Overloads not returning appropriate info. [Field reflunkory]

2019-04-09 Thread Alex via Digitalmars-d-learn
On Tuesday, 9 April 2019 at 18:56:58 UTC, H. S. Teoh wrote: On Tue, Apr 09, 2019 at 06:33:21PM +, Seb via Digitalmars-d-learn wrote: On Tuesday, 9 April 2019 at 16:30:53 UTC, Alex wrote: > On Tuesday, 9 April 2019 at 14:59:03 UTC, Adam D. Ruppe > wrote: > > [...] > I didn't say the

Re: Templates - What's Up with the template keyword?

2019-04-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/9/19 4:31 PM, Ron Tarrant wrote: I'm still struggling to understand templates, but I'll keep at it. When I first saw C++ templates, I thought "what the hell is this black magic", and had no idea how they worked. In fact, this was back before STL, and I recall it was a set of templates

Re: Overloads not returning appropriate info. [Field reflunkory]

2019-04-09 Thread Alex via Digitalmars-d-learn
On Tuesday, 9 April 2019 at 18:33:21 UTC, Seb wrote: On Tuesday, 9 April 2019 at 16:30:53 UTC, Alex wrote: On Tuesday, 9 April 2019 at 14:59:03 UTC, Adam D. Ruppe wrote: [...] I didn't say the language. The point with the language is that it could have built in semantics to do reflection in a

Re: Templates - What's Up with the template keyword?

2019-04-09 Thread Ron Tarrant via Digitalmars-d-learn
On Tuesday, 9 April 2019 at 14:41:30 UTC, Alex wrote: Your confusion arises in your understanding of meta programming and templates. Templates are compile time expressions that use parameters. This sounds like another 'no.' :) Thanks for all the info, Alex.

Re: Templates - What's Up with the template keyword?

2019-04-09 Thread Ron Tarrant via Digitalmars-d-learn
On Tuesday, 9 April 2019 at 14:25:18 UTC, Mike Parker wrote: Off the top of my head, to get a Singleton template, you could implement all of your singleton plumbing (thread safety if you need it, etc) in the template and add a `static _instance` member just as you would for any non-templated

Re: Overloads not returning appropriate info. [Field reflunkory]

2019-04-09 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Apr 09, 2019 at 06:33:21PM +, Seb via Digitalmars-d-learn wrote: > On Tuesday, 9 April 2019 at 16:30:53 UTC, Alex wrote: > > On Tuesday, 9 April 2019 at 14:59:03 UTC, Adam D. Ruppe wrote: > > > [...] > > I didn't say the language. The point with the language is that it > > could have

Re: Overloads not returning appropriate info. [Field reflunkory]

2019-04-09 Thread Seb via Digitalmars-d-learn
On Tuesday, 9 April 2019 at 16:30:53 UTC, Alex wrote: On Tuesday, 9 April 2019 at 14:59:03 UTC, Adam D. Ruppe wrote: [...] I didn't say the language. The point with the language is that it could have built in semantics to do reflection in a inform way(__traits is somewhat uniform but messy

Re: Overloads not returning appropriate info. [Field reflunkory]

2019-04-09 Thread Alex via Digitalmars-d-learn
On Tuesday, 9 April 2019 at 14:59:03 UTC, Adam D. Ruppe wrote: On Tuesday, 9 April 2019 at 14:42:38 UTC, Alex wrote: It basically proves my point that there are issues with D. The language is fine in this case, it is a bug in the library. I didn't say the language. The point with the

Re: const of AliasSeq is silently ignored

2019-04-09 Thread Paul Backus via Digitalmars-d-learn
On Monday, 8 April 2019 at 19:56:50 UTC, Yuxuan Shui wrote: In this example: const(AliasSeq!(int, int)) a; pragma(msg, typeof(a)); // (int, int) This kind of make sense, since AliasSeq is not a "single" type. But silently dropping const seems bad, the compiler should probably report

Re: Overloads not returning appropriate info. [Field reflunkory]

2019-04-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 9 April 2019 at 14:42:38 UTC, Alex wrote: It basically proves my point that there are issues with D. The language is fine in this case, it is a bug in the library. Though, I don't think the library can be fixed because the language doesn't have facilities to express these things

Re: Overloads not returning appropriate info. [Field reflunkory]

2019-04-09 Thread Alex via Digitalmars-d-learn
On Monday, 8 April 2019 at 21:52:59 UTC, Adam D. Ruppe wrote: On Saturday, 6 April 2019 at 12:20:28 UTC, Alex wrote: Error: variable `std.traits.ParameterDefaults!(foo).Get!1u.Get` only parameters or stack based variables can be `inout` so i think that is a bug in the phobos library see:

Re: const of AliasSeq is silently ignored

2019-04-09 Thread Alex via Digitalmars-d-learn
On Monday, 8 April 2019 at 19:56:50 UTC, Yuxuan Shui wrote: In this example: const(AliasSeq!(int, int)) a; pragma(msg, typeof(a)); // (int, int) This kind of make sense, since AliasSeq is not a "single" type. But silently dropping const seems bad, the compiler should probably report

Re: Templates - What's Up with the template keyword?

2019-04-09 Thread Alex via Digitalmars-d-learn
On Monday, 8 April 2019 at 12:23:28 UTC, Ron Tarrant wrote: I'm digging into templates in an attempt to understand the signals-n-slots replacement for the observer pattern, but I've got a question I can't seem to find an answer for and an example for which I'm unable to solve the error.

Re: Templates - What's Up with the template keyword?

2019-04-09 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 9 April 2019 at 10:53:49 UTC, Ron Tarrant wrote: On Monday, 8 April 2019 at 14:56:46 UTC, Mike Parker wrote: In the subsequent sections, I show both long and short (eponymous) forms of enum and function templates. In your book, Mike, you stated: Remember, a template is only

Re: Templates - What's Up with the template keyword?

2019-04-09 Thread Ron Tarrant via Digitalmars-d-learn
On Monday, 8 April 2019 at 14:56:46 UTC, Mike Parker wrote: In the subsequent sections, I show both long and short (eponymous) forms of enum and function templates. In your book, Mike, you stated: Remember, a template is only instantiated once for each set of arguments and the same

Re: D threading and shared variables

2019-04-09 Thread Archie Allison via Digitalmars-d-learn
On Sunday, 7 April 2019 at 22:18:56 UTC, Johan Engelen wrote: On Sunday, 7 April 2019 at 14:08:07 UTC, Archie Allison wrote: This generally works OK when tied to a Console but when link options are changed to be SUBSYSTEM:WINDOWS and ENTRY:mainCRTStartup it rarely does. Manually setting

gtkDcoding Blog Post #0025 - LinkButtons

2019-04-09 Thread Ron Tarrant via Digitalmars-d-learn
Good morning! A new post is up on the gtkDcoding blog. It's all about the LinkButton and you can find it here: http://gtkdcoding.com/2019/04/09/0025-creating-and-using-a-linkButton.html

Re: Cannot link vibe.d sample / optlink error

2019-04-09 Thread Seb via Digitalmars-d-learn
On Tuesday, 9 April 2019 at 06:50:36 UTC, Michal Minich wrote: On Monday, 8 April 2019 at 14:49:02 UTC, Radu wrote: [...] Thank you Radu! Your answer helped and hello word is now running :) After using --verbose I found that I do not have libcmt.lib on my computer at all. Though I have

Re: Cannot link vibe.d sample / optlink error

2019-04-09 Thread Michal Minich via Digitalmars-d-learn
On Monday, 8 April 2019 at 14:49:02 UTC, Radu wrote: Hi there, Compiling with 2.085.1 on Windows 10 works with `dub --arch=x86_mscoff` LDC 1.15.0 works for x86/x86_64. Tested also on a fresh VMWare instance running Windows 7. You can try running it with `dub --arch=x86_mscoff --verbose` in