On Thu, 2007-09-20 at 00:51 -0700, Erick Tryzelaar wrote:
> On 9/20/07, skaller <[EMAIL PROTECTED]> wrote:

> > Now, actually I lied about 2^N: if we follow the C++/tuple technology,
> > then N defaults only makes N+1 functions (all args, the last one
> > cut off, the last 2 cut off, etc ..).
> >
> > Only interesting case then is an array of 20,000 zeros with
> > the initial elements specified .. :)
> 
> Thats true, but I always hated that about c++. You have to call
> functions with such a huge list of temp variables which just make no
> sense without referring to some api document. You've dealt with win32,
> you know what I mean :)
> 
> Plus, if it doesn't automatically generate those intermediary helper
> functions, it's just a pain having to do the "f (a:int) => f (a, 1,
> 2)", "f (a:int, b:int) => f (a, b, 2)", "f(a:int, b:int, c:int) =
> {...}", and be a maintenance nightmare if you ever have to propagate
> changes to the defaults.

It's not clear how to do it though. If you have one function f
with 20 arguments, 18 of which are defaulted, it seems easy to
just override the defaults you don't like (one way of the other).

The problem comes if you have 20 functions called f.

Especially if they're polymorphic :)

Well, actually the problem is worst if you have 3 functions
with 3 arguments and a couple of defaults: it's more or less
impossible to tell which one a particular call is invoking.

The problem seems simpler for a struct, because there can only
be one of them, with default arguments, and a record constructor
which overrides/specifies some of them: all you need then
is a completeness check on the components:

        struct X { a:int=1; b:int; c:int=2; };
                                                     /
        X (a=11,b=22); // c=2 by default, complete \/

Still .. you could just do that for function overload
candidates one by one... hmm..


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to