PRE-PROPOSAL: Named method parameters with defaults.

Marek Kozieł develop4lasu at gmail.com
Sun Mar 22 18:25:26 PDT 2009


2009/3/23 Reinier Zwitserloot <reinier at zwitserloot.com>:
> If your goal is to find a way to eliminate the builder pattern - good luck.
> I don't think any proposal other than the builder pattern can replace the
> builder pattern. Even python and friends have rare usage of the builder
> pattern.
>
> This proposal has named parameters, defaults, and allows shuffling order.
> What more could you possibly  want out of a proposal to make direct method
> invocation easier when there are many parameters?
>
>  --Reinier Zwitserloot
>


I need ask you about something.
Where do you see problem:
 - when creating such method invocation?
 - reading such invocation?
 - while refactoring?

My conclusions:
- default values are quite good if blank === default, and even better
if blank === null === default

- reordering parameters is wrong path, will create more confusion: 9
parameters mean 9! = 362880 combinations o.O

- having named parameters is OK, but not in given form:
   method(Some some){
      call(some = “New”,...);
   }
'some' is parameter in call or variable from current block.


Maybe IDE (with compiler) should create proper signature( and re-check it):
   method(Some some){
      call(
         /** some =*/ “New”
         ,...
         );
   }
or
   method(Some some){
      call(
         “New” //* some
         ,1       //* length
         ,...
         );
   }

-- 
Pozdrowionka. / Regards.
Lasu aka Marek Kozieł

http://lasu2string.blogspot.com/



More information about the coin-dev mailing list