Re: guidelines for parameter types

2012-12-18 Thread Dan
On Tuesday, 18 December 2012 at 06:34:55 UTC, Ali Çehreli wrote: I don't think this is well known at all. :) I have thought about these myself and came up with some guidelines at http://ddili.org/ders/d.en Thanks - I will study it. I see that you have covered also in, out, inout, lazy,

Re: guidelines for parameter types

2012-12-18 Thread Ali Çehreli
On 12/18/2012 04:51 AM, Dan wrote: On Tuesday, 18 December 2012 at 06:34:55 UTC, Ali Çehreli wrote: I don't think this is well known at all. :) I have thought about these myself and came up with some guidelines at http://ddili.org/ders/d.en Thanks - I will study it. I see that you have

Re: guidelines for parameter types

2012-12-18 Thread H. S. Teoh
On Tue, Dec 18, 2012 at 01:51:31PM +0100, Dan wrote: On Tuesday, 18 December 2012 at 06:34:55 UTC, Ali Çehreli wrote: [...] That makes a difference whether V is a value type or not. (It is not clear whether you mean V is a value type.) Otherwise, e.g. immutable(char[]) v has a legitimate

Re: guidelines for parameter types

2012-12-18 Thread Dan
On Tuesday, 18 December 2012 at 18:08:18 UTC, H. S. Teoh wrote: It's not just about whether the function mutates something or not. Sometimes the function counts on the data not changing, ever. For example, if you're implementing a library AA type, you'd want the key to be immutable so that

guidelines for parameter types

2012-12-17 Thread Dan
Assume V is a non-template parameter type and v is a parameter of that type for any function. Also assume T is a template parameter type and t is a parameter of that type for any function. Is the following table and set of guidelines below reasonable? What other guidelines do you use or would

Re: guidelines for parameter types

2012-12-17 Thread Dan
On Monday, 17 December 2012 at 20:46:27 UTC, Dan wrote: Sorry, here is the table more legible: http://pastebin.com/0bFSL0Xz

Re: guidelines for parameter types

2012-12-17 Thread Dan
On Monday, 17 December 2012 at 21:12:16 UTC, bearophile wrote: Are in, out, scope, std.typecons.Nullable, std.typecons.Rebindable missing in your table? Bye, bearophile Not at all - I cringe at the thought of dealing with those as well now. But if you want to give them a go as well I'd be

Re: guidelines for parameter types

2012-12-17 Thread Ali Çehreli
Thank you very much for doing the hard work on this. I find this kind of information very important. On 12/17/2012 12:46 PM, Dan wrote: Assume V is a non-template parameter type and v is a parameter of that type for any function. Also assume T is a template parameter type and t is a