« Return to Thread: Named and default arguments SID

Re: Named and default arguments SID

by Stepan Koltsov-5 :: Rate this Message:

Reply to Author | View in Thread

On Sat, Jun 6, 2009 at 17:30, Lukas Rytz<lukas.rytz@...> wrote:

>> Hi, all.
>>
>> I've just read latest version of named and default arguments specification
>>
>> http://www.scala-lang.org/sid/1
>>
>> In first version of specification, unset arguments were passed by
>> extra mask parameter.
>>
>> In this verison, for each argument with default value extra method is
>> created.
>>
>> First version has an advantage of much simpler bytecode (only one
>> extra method in declaration, and no extra method calls at method call
>> site), so smaller class size, faster code loading, reduced memory
>> usage and so on.
>>
>> What are advantages of current specification?
>
> IIRC, the first version didn't work well for
>  - call site evaluation order

Explain, please.

>  - subclassing (inheriting / adding / overridding defaults)

Defaults should not be overridable, whatever specification is. I. e.
when you override method, you cannot specify any default parameters.
That makes specification and implementation simpler.

S.

 « Return to Thread: Named and default arguments SID