Re: Make alias parameter optional?

2012-02-27 Thread David Nadlinger
On Monday, 27 February 2012 at 19:34:45 UTC, Robert Rouse wrote: Which thing? Delegates can already access variables outside, because that's what they are for. The »returning from block returns from outer function« part. Also applies to similar control statements. David

Re: Make alias parameter optional?

2012-02-27 Thread Robert Rouse
On Monday, 27 February 2012 at 14:57:56 UTC, Ary Manzana wrote: On 2/25/12 10:04 PM, Robert Rouse wrote: On Saturday, 25 February 2012 at 23:10:51 UTC, Ary Manzana wrote: On 2/25/12 7:31 PM, Robert Rouse wrote: On Saturday, 25 February 2012 at 22:12:55 UTC, Ali Çehreli wrote: On 02/25/2012

Re: Make alias parameter optional?

2012-02-27 Thread Ary Manzana
On 2/25/12 10:04 PM, Robert Rouse wrote: On Saturday, 25 February 2012 at 23:10:51 UTC, Ary Manzana wrote: On 2/25/12 7:31 PM, Robert Rouse wrote: On Saturday, 25 February 2012 at 22:12:55 UTC, Ali Çehreli wrote: On 02/25/2012 01:55 PM, Robert Rouse wrote: On Saturday, 25 February 2012 at 1

Re: Make alias parameter optional?

2012-02-27 Thread Jacob Carlborg
On 2012-02-27 00:04, Ali Çehreli wrote: On 02/26/2012 03:45 AM, Jacob Carlborg wrote: > On 2012-02-26 11:03, Ali Çehreli wrote: >> On 02/25/2012 05:04 PM, Robert Rouse wrote: >> > On Saturday, 25 February 2012 at 23:10:51 UTC, Ary Manzana wrote: >> >> On 2/25/12 7:31 PM, Robert Rouse wrote:

Re: Make alias parameter optional?

2012-02-26 Thread Ali Çehreli
On 02/26/2012 03:45 AM, Jacob Carlborg wrote: > On 2012-02-26 11:03, Ali Çehreli wrote: >> On 02/25/2012 05:04 PM, Robert Rouse wrote: >> > On Saturday, 25 February 2012 at 23:10:51 UTC, Ary Manzana wrote: >> >> On 2/25/12 7:31 PM, Robert Rouse wrote: >> >> ... >> >> >>> This means that D can simu

Re: Make alias parameter optional?

2012-02-26 Thread Jacob Carlborg
On 2012-02-26 11:03, Ali Çehreli wrote: On 02/25/2012 05:04 PM, Robert Rouse wrote: > On Saturday, 25 February 2012 at 23:10:51 UTC, Ary Manzana wrote: >> On 2/25/12 7:31 PM, Robert Rouse wrote: ... >>> This means that D can simulate Ruby blocks more than I thought. That's >>> pretty awesom

Re: Make alias parameter optional?

2012-02-26 Thread Ali Çehreli
On 02/25/2012 05:04 PM, Robert Rouse wrote: > On Saturday, 25 February 2012 at 23:10:51 UTC, Ary Manzana wrote: >> On 2/25/12 7:31 PM, Robert Rouse wrote: ... >>> This means that D can simulate Ruby blocks more than I thought. That's >>> pretty awesome. I'm loving D more every day. >> >> How's t

Re: Make alias parameter optional?

2012-02-25 Thread Andrej Mitrovic
On 2/25/12, Ali Çehreli wrote: > Apparently template parameters > with default values need not be at the end of the template parameter list Well it would make variadic templates rather hard to use if this was illegal: void print(bool pretty = false, T...)(T args) { } void main() { print(1, "two"

Re: Make alias parameter optional?

2012-02-25 Thread Robert Rouse
On Saturday, 25 February 2012 at 23:10:51 UTC, Ary Manzana wrote: On 2/25/12 7:31 PM, Robert Rouse wrote: On Saturday, 25 February 2012 at 22:12:55 UTC, Ali Çehreli wrote: On 02/25/2012 01:55 PM, Robert Rouse wrote: On Saturday, 25 February 2012 at 18:54:35 UTC, Trass3r wrote: void foo(T,

Re: Make alias parameter optional?

2012-02-25 Thread Ary Manzana
On 2/25/12 7:31 PM, Robert Rouse wrote: On Saturday, 25 February 2012 at 22:12:55 UTC, Ali Çehreli wrote: On 02/25/2012 01:55 PM, Robert Rouse wrote: On Saturday, 25 February 2012 at 18:54:35 UTC, Trass3r wrote: void foo(T, T2, alias thing = (){})(T a, T2 b) { thing(); } void bar(){} void

Re: Make alias parameter optional?

2012-02-25 Thread Robert Rouse
On Saturday, 25 February 2012 at 22:12:55 UTC, Ali Çehreli wrote: On 02/25/2012 01:55 PM, Robert Rouse wrote: On Saturday, 25 February 2012 at 18:54:35 UTC, Trass3r wrote: void foo(T, T2, alias thing = (){})(T a, T2 b) { thing(); } void bar(){} void main() { foo!(int,int,bar)(1,2); foo(1,2)

Re: Make alias parameter optional?

2012-02-25 Thread Ali Çehreli
On 02/25/2012 01:55 PM, Robert Rouse wrote: On Saturday, 25 February 2012 at 18:54:35 UTC, Trass3r wrote: void foo(T, T2, alias thing = (){})(T a, T2 b) { thing(); } void bar(){} void main() { foo!(int,int,bar)(1,2); foo(1,2); } Cool. Didn't know you can do that, but I guess it makes sense t

Re: Make alias parameter optional?

2012-02-25 Thread Robert Rouse
On Saturday, 25 February 2012 at 18:54:35 UTC, Trass3r wrote: void foo(T, T2, alias thing = (){})(T a, T2 b) { thing(); } void bar(){} void main() { foo!(int,int,bar)(1,2); foo(1,2); } Cool. Didn't know you can do that, but I guess it makes sense that it would work th

Re: Make alias parameter optional?

2012-02-25 Thread Trass3r
void foo(T, T2, alias thing = (){})(T a, T2 b) { thing(); } void bar(){} void main() { foo!(int,int,bar)(1,2); foo(1,2); }

Make alias parameter optional?

2012-02-25 Thread Robert Rouse
Is it possible to do something like this? void foo(T, T2, alias thing)(T a, T2 b) { // do stuff with a // call b (since b would be a delegate) // call thing if thing is given } I come from the Ruby world and I'm just playing around to see how much I can replicate of the "block" functional