On Sun, 07 Nov 2010 11:24:37 -0500
Jesse Phillips <[email protected]> wrote:
> > And I'd like to know, as a possible workaround, if there is a way to save a
> > variadic arg list:
> > class C {
> > ??? xs;
> > this(X xs...) {
> > this.xs = xs;
> > }
> > }
> >
> > Denis
> > -- -- -- -- -- -- --
> > vit esse estrany ☣
> >
> > spir.wikidot.com
> >
>
> You it is a typed variadic list (as shown above) it is just an array of that
> type so you should be able to save it to an X[]. If you are using the unsafe
> version then, no.
No, in fact a variadic param list is not an array -- this is according to TDPL
an iternal type of the language. Trying to assign it to an X[] var throws:
DeeMatch.d(371): Error: cannot implicitly convert expression (patterns) of type
DeeMatch.Pattern to Pattern[]
Well, actually, the type of the expression given in the error
(DeeMatch.Pattern) is wrong: this is the type of each element of the variadic
list.
Denis
-- -- -- -- -- -- --
vit esse estrany ☣
spir.wikidot.com