Default argument values

Brad Roberts braddr at
Thu May 20 16:21:02 PDT 2010

On Thu, 20 May 2010, bearophile wrote:

> Brad Roberts:
> >Converting these to helpers functions will result in a tiny little function that will be inlined, so, right back to the same basic problem.<
> I am not sure, but in Scala they can be virtual functions, so the HotSpot inlines/deinlines them dynamically and as needed to keep the code both fast and safe all the time.

There's a key difference.. runtime optimization.

Moving the optimizing to runtime allows the code to stay properly isolated 
in terms of storage and how it's bundled for shipping to end users.  
Because the default handling can be bundled on the 'right' side of the 
caller/callee barrier, it eliminates the problem of replacing the 
implementation with the new default and by optimizing at runtime, 
eliminates the overhead of the extra function call.  A win win.. except 
for the cost of performing the optimizations at runtime and the vm in 

But that technique can't be done short of runtime optmizing, which 
c-family languages (such as D) don't do.

So, choose your set of problems.. not really a single one that solves them 
all yet.


More information about the Digitalmars-d mailing list