June 23, 2004
How would you determine if an argument is of any object type? I think you have to either test for all the object types, or require the caller to cast them all to Object and just test for that. Would it be possible to make it simpler?


There should be a way to use in/out/inout. I have some ideas:

1) Allow the caller to specify in/out/inout for parameters like:
   void foo(...);
   int var;
   foo(out var);
This would also be nice for self documenting your code, even for regular
functions:
   void bar(out int);
   int var;
   bar(out var);
It wouldn't have to be required; but if it's specified, it must match.

2) Allow in/out/inout to be used with ... like:
   void scan(out ...);
   int var;
   scan(var); // var is out.
Probably a lot easier to implement, but is less versatile.

3) Just use pointers instead ...


The documentation says that the type of _arguments is typeinfo[] but it's actually TypeInfo[]. It also says that _argptr is void* but it might confuse people using std.c.stdarg which expects type va_list (I know they're the same type under the alias).


June 23, 2004
"Vathix" <vathixSpamFix@dprogramming.com> wrote in message news:cbcfjd$stg$1@digitaldaemon.com...
> How would you determine if an argument is of any object type?

    if (cast(TypeInfoClass)typeid(arg)) ...

> There should be a way to use in/out/inout. I have some ideas:
>
> 1) Allow the caller to specify in/out/inout for parameters like:
>    void foo(...);
>    int var;
>    foo(out var);
> This would also be nice for self documenting your code, even for regular
> functions:
>    void bar(out int);
>    int var;
>    bar(out var);
> It wouldn't have to be required; but if it's specified, it must match.
>
> 2) Allow in/out/inout to be used with ... like:
>    void scan(out ...);
>    int var;
>    scan(var); // var is out.
> Probably a lot easier to implement, but is less versatile.
>
> 3) Just use pointers instead ...

I'll go with (3). Variadic functions are rare, so I don't think they need as
much support.

> The documentation says that the type of _arguments is typeinfo[] but it's actually TypeInfo[].

Fixed, thanks.

> It also says that _argptr is void* but it might confuse
> people using std.c.stdarg which expects type va_list (I know they're the
> same type under the alias).

std.c.stdarg is obsolete, should use std.stdarg instead now.