Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-22 Thread Sjoerd Nijboer via Digitalmars-d
On Tuesday, 22 May 2018 at 14:56:52 UTC, Ethan wrote: Repeat ad infinitum for each slightly different configuration you want. I always make the point of programmers being lazy by definition, and not being able to do something as simple as declare a type with a single statement is an clear

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-22 Thread jmh530 via Digitalmars-d
On Tuesday, 22 May 2018 at 15:25:47 UTC, Jonathan M Davis wrote: Honestly, I hate named argumts in general. This situation is one of the few places I've ever run into where I thought that they made any sense. [snip] It's quite literally the only reason I ever want named arguments.

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-22 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, May 22, 2018 14:53:50 Jacob Carlborg via Digitalmars-d wrote: > On Tuesday, 22 May 2018 at 11:08:13 UTC, Jonathan M Davis wrote: > > That's basically what dxml does except that it takes advantage > > of the fact that each member is a different type (because each > > is a differnt

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-22 Thread Ethan via Digitalmars-d
On Monday, 21 May 2018 at 14:36:32 UTC, Jacob Carlborg wrote: enum Options options = { foo: true, bar: false, a: 42, b: "guess what this does" }; SomeObject!options o; Yeah, so this is one reason why I went the parsing way. enum Options Options1 = { foo: false, a: 5 }; SomeObject!Options1

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-22 Thread Jacob Carlborg via Digitalmars-d
On Tuesday, 22 May 2018 at 11:08:13 UTC, Jonathan M Davis wrote: That's basically what dxml does except that it takes advantage of the fact that each member is a different type (because each is a differnt instance of std.typecons.Flag) so that it can have a variadic function which takes any

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-22 Thread Jonathan M Davis via Digitalmars-d
On Monday, May 21, 2018 14:07:45 Jacob Carlborg via Digitalmars-d wrote: > On Monday, 21 May 2018 at 00:13:26 UTC, Ethan wrote: > > Code for context: > > https://github.com/GooberMan/binderoo/blob/master/binderoo_client/d/src/ > > binderoo/util/enumoptions.d > > > > Something struck me at DConf. I

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-21 Thread crimaniak via Digitalmars-d
On Monday, 21 May 2018 at 07:10:34 UTC, rikki cattermole wrote: alias DocumentType = SomeDocument!( ObjectVersion._1_0, ObjectEncoding.PlainASCII ); alias DocumentType2 = SomeDocument!( ObjectEncoding.UTF8, ObjectVersion._2_0 ); typedef basic_stringstring; typedef basic_string wstring;

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-21 Thread Sjoerd Nijboer via Digitalmars-d
On Monday, 21 May 2018 at 14:36:32 UTC, Jacob Carlborg wrote: enum Options options = { foo: true, bar: false, a: 42, b: "guess what this does" }; SomeObject!options o; -- /Jacob Carlborg I like this especially if you mix it with: enum Options options = { foo: true, bar: false, a: 42, b:

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-21 Thread Jacob Carlborg via Digitalmars-d
On Monday, 21 May 2018 at 14:23:07 UTC, Steven Schveighoffer wrote: But how do you use it? SomeObject!(Options(true, false, 42, "guess what this does")) Yes, or if you want something more readable: enum Options options = { foo: true, bar: false, a: 42, b: "guess what this does" };

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-21 Thread Steven Schveighoffer via Digitalmars-d
On 5/21/18 10:07 AM, Jacob Carlborg wrote: On Monday, 21 May 2018 at 00:13:26 UTC, Ethan wrote: Code for context: https://github.com/GooberMan/binderoo/blob/master/binderoo_client/d/src/binderoo/util/enumoptions.d Something struck me at DConf. I was watching the dxml talk and hearing about

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-21 Thread Jacob Carlborg via Digitalmars-d
On Monday, 21 May 2018 at 00:13:26 UTC, Ethan wrote: Code for context: https://github.com/GooberMan/binderoo/blob/master/binderoo_client/d/src/binderoo/util/enumoptions.d Something struck me at DConf. I was watching the dxml talk and hearing about all these things that weren't being

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-21 Thread Ethan via Digitalmars-d
On Monday, 21 May 2018 at 13:22:33 UTC, Steven Schveighoffer wrote: Filter was written before static foreach existed. This is a pretty low-hanging fruit if anyone wants to try it out. -Steve I've gone to the effort after all, I might as well just port my code across. I'll look in to it.

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-21 Thread Steven Schveighoffer via Digitalmars-d
On 5/21/18 5:30 AM, Ethan wrote: On Monday, 21 May 2018 at 03:30:37 UTC, Paul Backus wrote: Am I missing something, or is this the same thing as `std.meta: Filter`? Nope, I am missing something. I don't find the std library documentation anywhere near as easy to look through as something

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-21 Thread Ethan via Digitalmars-d
On Monday, 21 May 2018 at 01:53:20 UTC, Manu wrote: I don't really like that SomeObject() will be instantiated a crap load of times for every possible combination and order of options that a user might want to supply. How do you control the bloat in a way that people won't mess up frequently?

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-21 Thread Ethan via Digitalmars-d
On Monday, 21 May 2018 at 03:30:37 UTC, Paul Backus wrote: Am I missing something, or is this the same thing as `std.meta: Filter`? Nope, I am missing something. I don't find the std library documentation anywhere near as easy to look through as something like cppreference.com, so I only

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-21 Thread rikki cattermole via Digitalmars-d
On 21/05/2018 12:13 PM, Ethan wrote: Code for context: https://github.com/GooberMan/binderoo/blob/master/binderoo_client/d/src/binderoo/util/enumoptions.d Something struck me at DConf. I was watching the dxml talk and hearing about all these things that weren't being implemented for one

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-20 Thread Dmitry Olshansky via Digitalmars-d
On Monday, 21 May 2018 at 01:53:20 UTC, Manu wrote: I don't really like that SomeObject() will be instantiated a crap load of times for every possible combination and order of options that a user might want to supply. How do you control the bloat in a way that people won't mess up frequently?

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-20 Thread Paul Backus via Digitalmars-d
On Monday, 21 May 2018 at 00:13:26 UTC, Ethan wrote: But the functions, they're a bit trickier. So I made a new trait in Binderoo's traits module called ExtractTupleOf. The template prototype is the following: template ExtractTupleOf( alias TestTemplate, Symbols... ) That first parameter is

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-20 Thread Manu via Digitalmars-d
I don't really like that SomeObject() will be instantiated a crap load of times for every possible combination and order of options that a user might want to supply. How do you control the bloat in a way that people won't mess up frequently? On 20 May 2018 at 17:58, Neia Neutuladh via

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-20 Thread Neia Neutuladh via Digitalmars-d
On Monday, 21 May 2018 at 00:13:26 UTC, Ethan wrote: Code for context: https://github.com/GooberMan/binderoo/blob/master/binderoo_client/d/src/binderoo/util/enumoptions.d This looks good. One small caveat: alias DocumentType = SomeDocument!(ObjectVersion._1_0, ObjectEncoding.UTF8); alias

A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-20 Thread Ethan via Digitalmars-d
Code for context: https://github.com/GooberMan/binderoo/blob/master/binderoo_client/d/src/binderoo/util/enumoptions.d Something struck me at DConf. I was watching the dxml talk and hearing about all these things that weren't being implemented for one reason or another. And I was thinking,