Modules vs. Packages

Neal Gafter neal at gafter.com
Thu Feb 5 03:16:05 EST 2009


That's a default parameter, not a named parameter.  A named parameter is
where you mention the name of the parameter when calling the method.  You
can't use an equals sign there because it already means something in the
language.  Calling your "draw" method using named parameters would probably
be something like

draw(x:3, y:12);

Regards,
Neal

On Wed, Feb 4, 2009 at 11:55 PM, Christopher Brind <brindy at brindy.org.uk>wrote:

> Why is a colon so important to named parameters?
>
> @SomeAnnotation(options = 1)
> void draw(int x, int y, Color color = BLACK);
>
> Seems to work just as well, (or just as badly, depending on your view
> point).
>
> Cheers,
> Chris
>
>
> 2009/2/5 Neal Gafter <neal at gafter.com>
>
> On Wed, Feb 4, 2009 at 10:25 PM, Paul Benedict <pbenedict at apache.org>wrote:
>>
>>> Joshua Bloch wrote in his latest "Effective Java" book that
>>> annotations, when first introduced, missed an opportunity to use the
>>> NAME:VALUE notation precedent. If that decision was made, it would be
>>> easy enough to expand the language for default parameter values too.
>>>
>>
>> When I first designed the syntax for annotations, I used a colon instead
>> of an equals sign for this reason.  Josh changed it to the equals sign,
>> insisting that Java will never have named parameters.  Given that it's too
>> late to go back to my original design, his change of heart is little
>> consolation.
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/jsr294-modularity-observer/attachments/20090205/3e788bc9/attachment-0001.html>


More information about the jsr294-modularity-observer mailing list