Michael Hunger wrote:
> When reading your post the get() set() in the accessor chain caught my eye 
> once again.
> 
> When doing stuff for squill (squill.dev.java.net) I used the shortes and 
> visually least impacting notation for method 
> names for creating tuples and accessing their values.
> 
> That is "_".
> 
> Could we add an optional shorthand notation that adds the following interface 
> onto Property
> 
> interface ShorthandProperty {
>   T _();
>   void _(T value);
> }
> which then just delegate to the get/set of Property?
> 
> That would change:
> person.name().get().givenName().get()
> to
> 
> person.name()._().givenName()._()
> 
> Which is (imho) more readable.

Ok, I checked and "_" is the only non-A2Z character allowed.

I tried implementing it, and it looked pretty ok, especially in chains. 
Instead of:
foo().get().bar().get().xyzzy().get()
you have:
foo()._().bar()._().xyzzy()._()

which is easier to read. Yes, compared to other languages it feels kind 
of silly, but... such is life.

/Rickard

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to