Re: Idioms you use

2015-10-05 Thread Artur Skawina via Digitalmars-d
On 10/05/15 17:53, Marco Leise via Digitalmars-d wrote: > Am Sun, 04 Oct 2015 00:08:39 +0200 > schrieb Artur Skawina via Digitalmars-d > : > >>static ctfe = ctfeArr!( iota(256).map!isDigit() ); >> >>immutable typeof(R.front)[R.array().length] ctfeArr(alias R)

Re: Idioms you use

2015-10-05 Thread Marco Leise via Digitalmars-d
Am Sun, 04 Oct 2015 00:08:39 +0200 schrieb Artur Skawina via Digitalmars-d : >static ctfe = ctfeArr!( iota(256).map!isDigit() ); > >immutable typeof(R.front)[R.array().length] ctfeArr(alias R) = R.array(); I like that. Also that 1) In D everything is

Re: Idioms you use

2015-10-03 Thread Marco Leise via Digitalmars-d
Am Mon, 28 Sep 2015 21:40:43 + schrieb Freddy <hexagonalsta...@gmail.com>: > Are any D idioms you use that you like to share? > Heres one of mine > --- > enum ctfe = > { > return 0xdead & 0xbad; > }(); > --- Yep, using that often, although I try to g

Re: Idioms you use

2015-10-03 Thread Artur Skawina via Digitalmars-d
On 10/03/15 15:53, Marco Leise via Digitalmars-d wrote: > Am Mon, 28 Sep 2015 21:40:43 + > schrieb Freddy <hexagonalsta...@gmail.com>: > >> Are any D idioms you use that you like to share? >> Heres one of mine >> --- >> enum ctfe = >> { >>

Re: Idioms you use

2015-09-29 Thread Cauterite via Digitalmars-d
On Monday, 28 September 2015 at 21:40:45 UTC, Freddy wrote: Are any D idioms you use that you like to share? I'm not sure if these fit under the definition of 'idiom', but they sort of areā€¦ I think. http://dpaste.dzfl.pl/f66a76a7411f You could even extend the concept with opDispatch

Re: Idioms you use

2015-09-29 Thread anonymous via Digitalmars-d
On Tuesday 29 September 2015 15:06, Cauterite wrote: > some statements Buf of course! I totally didn't think of multiple statements. Thanks.

Re: Idioms you use

2015-09-29 Thread anonymous via Digitalmars-d
On Monday 28 September 2015 23:40, Freddy wrote: > Are any D idioms you use that you like to share? > Heres one of mine > --- > enum ctfe = > { > return 0xdead & 0xbad; > }(); > --- Why not just `enum ctfe = 0xdead & 0xbad;`? Are there cases where `en

Re: Idioms you use

2015-09-29 Thread Adam D. Ruppe via Digitalmars-d
On Tuesday, 29 September 2015 at 12:52:36 UTC, anonymous wrote: Are there cases where `enum foo = {return bar;}();` works but `enum foo = bar;` doesn't? And if there are, aren't they compiler bugs? If it is more complex than just one statement, putting it in a function lets you execute

Re: Idioms you use

2015-09-29 Thread Cauterite via Digitalmars-d
On Tuesday, 29 September 2015 at 12:52:36 UTC, anonymous wrote: Why not just `enum ctfe = 0xdead & 0xbad;`? Are there cases where `enum foo = {return bar;}();` works but `enum foo = bar;` doesn't? And if there are, aren't they compiler bugs? I'm pretty sure he's talking about the general

Idioms you use

2015-09-28 Thread Freddy via Digitalmars-d
Are any D idioms you use that you like to share? Heres one of mine --- enum ctfe = { return 0xdead & 0xbad; }(); ---

Re: Idioms you use

2015-09-28 Thread lobo via Digitalmars-d
On Monday, 28 September 2015 at 21:40:45 UTC, Freddy wrote: Are any D idioms you use that you like to share? Heres one of mine --- enum ctfe = { return 0xdead & 0xbad; }(); --- What does this do and where would it be useful in my code? For D idioms I usually go here...you may