PRE-PROPOSAL: Named method parameters with defaults.
rssh at gradsoft.com.ua
rssh at gradsoft.com.ua
Sun Mar 22 00:27:39 PDT 2009
>
> The 'named' is a new context sensitive keyword (if 'module' can be
> one, then this isn't too much of a stretch), and, only for named
> methods, you can supply expressions that serve as defaults. Each
> expression is evaluated exactly once, during your class initialization
> (so, the ArrayList above is SHARED amongst all method invocations! -
> I'd force it to be immutable but java does not have such a facility).
>
It is possible to restrict default parameters be final. It's not exactly
'immutable' but better than nothing.
>
>
> Three questions:
>
> A) Is this a good idea? Do you like it? Would you use it? (I think its
> stellar, but then, I'm proposing it).
>
for me - all ok except extra keyword. I think that it is possible do not
add new keyword (by example - using annotation, which can be not only
package-level, but class-level (for all methods) and package-level(for
all classes in packages and subpackages); IMHO better just view all
method as
named, cost of incompatibility is less, than cost of adding new word in
near each method definition)
//Also Note, that javac is not only implementation of java parser, exists
many parsers in tools, build with javacc and antrlr, wich have no support
for 'context-depended' keywords in grammar. Adding each 'context-depended'
framework to such grammars is non-trivial hack.
> B) Did I miss something (is it more complicated than I make it out to
> be), or is something unclear? Specifically, did I miss something that
> does not make it backwards, migration, and source compatible?
>
> C) Might this be within scope for project coin? I'll definitely write
> it up if it stands a chance.
>
>
> --Reinier Zwitserloot
>
>
>
> On Mar 21, 2009, at 18:56, Marek Kozieе┌ wrote:
>
>> Builders are really great tool, but they need to be written manually.
>>
>> In other way there will be problem, if final object need contains data
>> and builder only key for that data.
>>
>>
>>
>> --
>> Pozdrowionka. / Regards.
>> Lasu aka Marek Kozieе┌
>>
>> http://lasu2string.blogspot.com/
>>
>
>
>
More information about the coin-dev
mailing list