Template context - OT variants
Aarti_pl
aarti at interia.pl
Mon Jan 8 04:35:39 PST 2007
Daniel Keep napisał(a):
>>
>> void varfunction(variant[] vals ...); // Same syntax like D typesafe
>> variadic functions.
>
> I've never liked the "magic" _arguments and _argptr. I always thought
> they should be explicitly named.
>
> Then again, I don't think a variant type is the answer. We have
> std.boxer.Box, but I think there must be a better solution for variadic
> functions. Perhaps some special construct for talking about a
> function's call stack in a portable way...
>
Hmmm... TypeInfo(_arguments) and pointer to data (_argptr) is 95% of
what variant type is... So why not to add this lacking 5 percent and get
following:
1. Unified method of calling variadic arguments functions
2. No _arguments and _argptr black magic things
3. No need to use of function boxArray()
4. FASTER implementation as no additional function call is necessary -
(you dont need to call box function as compiler (probably) can do
everything on compile time)
5. No need for box function for function when calling following:
void func(int a1, float a2, variant a3);
func(5, 2.5, "text");
In this point I mean clear syntax - not a speed gain.
6. Powerful functionality to implement e.g. database recordsets
Currently I am trying to implement universal Query object, which will
contain all information about SQL query, but not using strings to
represent that query - just abstract objects. It seems that using
variant type is by a few factors easier, more flexible and faster to
implement than using carefully implemented class hirarchy as in e.g.
Java's Hibernate:
http://fisheye.jboss.org/browse/Hibernate/trunk/Hibernate3/src/org/hibernate/criterion
I will send some code when I finish...
Regards
Marcin Kuszczak
Aarti_pl
More information about the Digitalmars-d
mailing list