Re: How to "Inherit" the attributes from a given callable argument?

2019-06-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, June 13, 2019 3:49:04 AM MDT Jacob Carlborg via Digitalmars-d- learn wrote: > On 2019-06-12 22:42, Mek101 wrote: > > I didn't know it applied to templates other than lambdas. > > > > Thank you for your explanation. > > It applies to templates, lambdas (which basically are templates)

Re: How to "Inherit" the attributes from a given callable argument?

2019-06-13 Thread Jacob Carlborg via Digitalmars-d-learn
On 2019-06-12 22:42, Mek101 wrote: I didn't know it applied to templates other than lambdas. Thank you for your explanation. It applies to templates, lambdas (which basically are templates) and nested functions. -- /Jacob Carlborg

Re: How to "Inherit" the attributes from a given callable argument?

2019-06-12 Thread Mek101 via Digitalmars-d-learn
I didn't know it applied to templates other than lambdas. Thank you for your explanation.

Re: How to "Inherit" the attributes from a given callable argument?

2019-06-12 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jun 12, 2019 at 07:46:12PM +, Mek101 via Digitalmars-d-learn wrote: [...] > > public size_t indexOf(alias pred = "a == b", Range)(Range array) > > { > > alias predicate = unaryFun!pred; > > for(size_t i = 0; i < array.length; i++) > > if(predicate(array[i])) > >

How to "Inherit" the attributes from a given callable argument?

2019-06-12 Thread Mek101 via Digitalmars-d-learn
I'll try to be straight. I have the following function: public size_t indexOf(alias pred = "a == b", Range)(Range array) { alias predicate = unaryFun!pred; for(size_t i = 0; i < array.length; i++) if(predicate(array[i])) return i;

Inherit of attributes

2014-04-25 Thread Temtaime via Digitalmars-d-learn
Hi ! http://dpaste.dzfl.pl/2fa3dd2ea834 Why S.init not pure ? Is it expected behavior or bug ? Thanks!

Re: Inherit of attributes

2014-04-25 Thread MrSmith via Digitalmars-d-learn
On Friday, 25 April 2014 at 07:59:29 UTC, Temtaime wrote: Hi ! http://dpaste.dzfl.pl/2fa3dd2ea834 Why S.init not pure ? Is it expected behavior or bug ? Thanks! Fix http://dpaste.dzfl.pl/03f73cd958f4

Re: Inherit of attributes

2014-04-25 Thread Temtaime via Digitalmars-d-learn
Hi, MrSmith ! Yes, i know that, but my question isn't about it. I want to type `pure:` at module's beginning and have all function(in classes, too) declared as pure. I think `pure:` should do it. But it doesn't.

Re: Inherit of attributes

2014-04-25 Thread Dicebot via Digitalmars-d-learn
On Friday, 25 April 2014 at 09:08:50 UTC, Temtaime wrote: Hi, MrSmith ! Yes, i know that, but my question isn't about it. I want to type `pure:` at module's beginning and have all function(in classes, too) declared as pure. I think `pure:` should do it. But it doesn't. pure is not a

Re: Inherit of attributes

2014-04-25 Thread Temtaime via Digitalmars-d-learn
Hi ! Thanks for reply. Why so ? And why @nogc not transitive too ?