[DGD]varargs void foo(object bar)
Frank Schmidt
franks at colargol.tihlde.hist.no
Mon Nov 30 15:18:54 CET 1998
To Marc:
Thanks for your scripts Marc.
I'm sure they'll help.
Over to Mikael:
On Mon, 30 Nov 1998, Mikael Lind wrote:
> Use ellipsis, the "..." operator. This is will convert an argument list to
> an array or vice versa, depending on the context.
Ah, yes, forgot to mention that possibility. But in many cases with
multiple argument types, that would require "void foo(mixed bar..)". This
looks pretty ugly, and leaves <foo> with the job to do all typechecking at
runtime.
> As far as I know, it's currently impossible to distinguish scenario 3 from
> scenario 4 from within the LPCd code. (And I don't see why you'd want to.)
I'm not, what I'm really interested in is distinguishing 1) from the
others, sorry for being a bit unclear.
> There's certainly more to say about the design issue of giving a function
> several different functionalities. Sometimes, it's more useful to split
> the function into two (or even more) functions:
Yes, I agree. I'm not after the
having-a-bundle-of-functionality-in-just-one-function wild goosechase.
What I'm really after is a way of supporting default (arbitrary) arguments
to functions. This isn't currently supported in DGD, and even the default
0-values are indistinguishable from a "normal" 0.
The function(s) performs just one function, it's just the arguments I'd
like to be default to; let's say this_object() for instance. This is no
problem, as long as I don't call the function with a destructed object.
Then I want an error generated saying that you cannot pass a 0 value as
argument to this function.
> It all depends on what it is that you want to do.
Yeppers. And I hope DGD will be able to support it in the future.
> [Insert a lengthy discussion on the benefits of argument-based function
> call binding here, if you find it at all necessary.]
WOw. Hard to argue against that ;)
Frank S.
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list