digitalmars.D - Why not support auto Boxing/unBoxing?
- "uframer" <uframer sina100.com> Jan 01 2005
- "Walter" <newshound digitalmars.com> Jan 01 2005
- "Carlos Santander B." <csantander619 gmail.com> Jan 31 2005
Auto Boxing/unBoxing can make the type system complete. It can make some
common cases easy/simple without making others ugly('cause we have
template:). Well, it may cause some performance problems, but i think we can
avoid these by using template. Template can do most of auto boxing/unboxing
do, but look at the example below:
// in c#, we can declare a function take arbitrary parameters like this
public class Console
{
public static void Write(string fmt, params object[] args);
}
i think all of you can under what these codes mean, it's handy. Can we use
template to archieve this in a splitted type system?
Waiting for your advices:)
Jan 01 2005
"uframer" <uframer sina100.com> wrote in message news:cr7njl$18j3$1 digitaldaemon.com...Auto Boxing/unBoxing can make the type system complete. It can make some common cases easy/simple without making others ugly('cause we have template:). Well, it may cause some performance problems, but i think we
avoid these by using template. Template can do most of auto
do, but look at the example below: // in c#, we can declare a function take arbitrary parameters like this public class Console { public static void Write(string fmt, params object[] args); } i think all of you can under what these codes mean, it's handy. Can we use template to archieve this in a splitted type system? Waiting for your advices:)
Autoboxing/unboxing are necessary features for a template system that does not support partial or explicit specialization. Since D does, the boxing support doesn't add critical value. I've always been a bit uncomfortable with it anyway from an efficiency standpoint. (Also, D has another way of doing typesafe variable argument lists.)
Jan 01 2005
uframer wrote:Auto Boxing/unBoxing can make the type system complete. It can make some common cases easy/simple without making others ugly('cause we have template:). Well, it may cause some performance problems, but i think we can avoid these by using template. Template can do most of auto boxing/unboxing do, but look at the example below: // in c#, we can declare a function take arbitrary parameters like this public class Console { public static void Write(string fmt, params object[] args); } i think all of you can under what these codes mean, it's handy. Can we use template to archieve this in a splitted type system? Waiting for your advices:)
The D Template Library (dtl, by Matthew Wilson, somewhat outdated ATM) provides std.box, but I can't guarantee you it'll work with the most recent DMD. The Apropos Library (by Andy Friesen, also outdated) also provides a boxing/unboxing feature. Again, I can't guarantee anything. Also, for "a function to take arbitrary parameters" (as you put it), you can use a variadic funtion. _______________________ Carlos Santander Bernal
Jan 31 2005









"Walter" <newshound digitalmars.com> 