Pretty please: Named arguments
Dmitry Olshansky
dmitry.olsh at gmail.com
Tue Mar 1 08:21:28 PST 2011
On 01.03.2011 15:52, Max Samukha wrote:
> On 01.03.2011 13:20, spir wrote:
>> I'm fed up with people opposing to features very relevant for code
>> clarity, which they are not forced to use, and can hardly bother when
>> reading code themselves. Is the second statement below really that hard
>> to read?
>> p = new Point([1,2,3], [3,2,1]);
>> p = new Point(color:[1,2,3], pos:[3,2,1]);
>
> I hate that "explicitness improves code clarity and readability"
> argument. It may be true in some cases but most of the time
> explicitness creates unnecessary redundancy that actually impairs
> readability. Add a couple more Point instances with explicitly
> specified argument names and you will have useless and annoying noise.
>
> Named arguments are definitely useful when one needs to avoid
> specifying default parameter values but I still think we can live a
> happy life without them. At least until D3.
Seconded.
--
Dmitry Olshansky
More information about the Digitalmars-d
mailing list