Proposal for Property Accessors

BGB cr88192 at gmail.com
Sat Jan 5 10:15:00 PST 2013


On 1/5/2013 10:17 AM, Noctarius wrote:
> Ok I took some time to make a deeper introduction in what I
> imagine to do:
> https://www.sourceprojects.org/default/2013/01/05/1357395720000.html
>
> As mentioned before it would be great if someone is interested in
> the topic and wants to help.

well, I guess this forum is more for JVM level stuff, whereas all this 
is more a Java compiler level feature, but oh well...


but, how about the syntax:
public int get color() { return iColor; }
public void set color(int value) { iColor=value; }
public int get[](int idx) { return array[idx]; }
public void set[](int idx, int value) { array[idx]=value; }

as-before, with them just converting to normal methods internally (with 
slightly mangled names).
when a person tries to access a field, the compiler may observe that the 
actual field does not exist or is not accessible, mangle the name (into 
the form used by a property), and then see that the property exists, and 
use this.


> Cheers Chris
>
> Am 05.01.2013 15:20, schrieb Noctarius:
>> Hey Yesterday I started a discussion (not yet very active) on
>> the java.net forums about adding Property Accessors to the Java
>> language.
>>
>> Currently I'm still not totally convinced on how to do all
>> that for example accessors for array index access but I'm
>> pretty sure there are good ideas out there in other's heads.
>>
>> The topic is not totally correct at the davinci ml but since
>> this would need a bit of implementation details in the JVM I
>> thought that maybe some of you guys are interested in the
>> general idea. I would be happy to see some of you contributing
>> ideas and maybe help on prototyping such an implementation.
>>
>> For me it would be the biggest problem to make this idea in an
>> OpenJDK project or JSR since I never did anything similar but
>> I hope someone can help with this as well.
>>
>> So I'll close in hope that there are more people out there
>> thinking about similar projects which can merge or see a
>> bigger potential in my thoughts.
>>
>> The link to the discussion:
>> http://www.java.net/forum/topic/jcp/general-jsr-discussion/properties-proposal
>>
>>   Thanks from Germany Christoph
>> _______________________________________________ mlvm-dev
>> mailing list mlvm-dev at openjdk.java.net
>> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
>>
>



More information about the mlvm-dev mailing list