PROPOSAL: Method and Field Literals (original) (raw)

Stephen Colebourne scolebourne at joda.org
Wed Mar 11 06:11:09 PDT 2009


I have thought for some time that this is one of the least controversial parts of FCM (http://docs.google.com/Doc?id=ddhp95vd_6hg3qhc , which really should be referenced).

My take on the comments so far:

Finally, it must be noted that adopting this approach to member literals implies the equivalent of boxing should you want to support FCM method references or BGGA eta expansions (same concept and syntax, but different name). There is a way avoid the boxing, by using a double hash: String##substring(int).

Thus, it could be argued that both member literals and method references should be designed together (and implemented together) to ensure a consistent design. Unfortunately, this leads on to the vexed question of BGGA function types which Coin cannot address.

In summary, the real question with the proposal is whether we can implement member literals independently of method references and closures? The answer is definitely yes if we use the ## syntax, and probably yes if we use #.

BTW, I do think that member literals are exactly the kind of change Java needs, as they remove a very painful use of strings and exceptions today. See http://incubator.apache.org/click/docs/why-click.html (section 3) for an example of strings for method names in use today. In all the FCM feedback, method literals and references have been clearly popular.

Stephen

2009/3/11 Jesse Wilson <jesse at swank.ca>:

Rich text (preferred) here: http://docs.google.com/View?docID=dhfm3hw262dxg677jn

Proposal: Method and Field Literals AUTHOR(S): Jesse Wilson



More information about the coin-dev mailing list