PROPOSAL: Auto-assignment Parameters

Marek Kozieł develop4lasu at gmail.com
Thu Mar 26 17:22:06 PDT 2009


W dniu 27 marca 2009 01:07 użytkownik Mark Mahieu
<markmahieu at googlemail.com> napisał:
>
>
> 2009/3/26 Marek Kozieł <develop4lasu at gmail.com>
>>
>> class Some{
>>
>>     private String name;
>>
>>     public this setName (String this.name){};
>>
>>     public this.name getName(){};
>>
>> }
>
> Leaving to one side the idea of returning 'this' from setName, yes
> auto-assignment parameters could easily be made to work on all non-abstract
> instance methods.
> As you suggest, this could be extended even further to return values, but
> one of the questions that raises is whether it's acceptable to omit the
> type, as you've done in your example (imagine what it would look like in a
> much bigger class with many more methods).
> Mark
>

This is the reason why i suggested allowing blocks in classes:

class Some{

  { // block for name
     private String name;

     public this setName (String this.name){};

     public this.name getName(){};
   }

 }

problem disappears when code is near, but there is no solution that
can replace good style.

We can also consider:

  {
     private String name;

     public this setName (String this.name){};

     public this.name 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.


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

http://lasu2string.blogspot.com/



More information about the coin-dev mailing list