PROPOSAL: Auto-assignment Parameters

Mark Mahieu markmahieu at
Fri Mar 27 07:10:06 PDT 2009

On 27 Mar 2009, at 00:22, Marek Kozieł wrote:
> We can also consider:
>   {
>      private String name;
>      public this setName (String{};
>      public String getName(){};
>    }
> While we have quite similar idea, they work really great with each
> other. I just still wander if that should go so far.

I think you're right to question whether this would be going too  
far.  Looking at the getter method, I don't see a clear gain over the  
way it would currently be written, ie,

	public String getName() {}

doesn't strike me as a definite improvement on:

	public String getName() { return name; }

So far, the only extension to the proposal which looks like it might  
be reasonable, is simply to allow it for method parameters in  
general.  I'm not convinced that it would be worthwhile, but for the  
sake of illustration here's the example again if that option were taken:

	private String name;

	public void setName(String {}

	public String getName() { return name; }

In this variation, the method name, field, and type are each  
mentioned once for the getter, and once for the setter, with no need  
to mention extra variables.  Improving on that would almost certainly  
require language support for properties in general, which isn't what  
this proposal is about (and isn't in scope for Coin).

Thanks for sharing your thoughts.



More information about the coin-dev mailing list