Curl support RFC
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Mar 14 10:39:49 PDT 2011
On 3/14/11 4:36 AM, Jonathan M Davis wrote:
> That's debatable. Some would argue one way, some another. Personally, I'd argue
> ubyte[]. I don't like void[] one bit. Others would agree with me, and yet others
> would disagree. I don't think that there's really a general agreement on whether
> void[] or ubyte[] is better when it comes to reading binary data like that.
void[]: "There is a typed array underneath, but I forgot its exact type".
Evidence: all array types convert to void[] automatically.
ubyte[]: "We're dealing with an array of octets here."
Evidence: ubyte[] has no special properties over T[].
All raw data reads should yield ubyte[], not void[]. This is because the
user may or may not know that underneath really there's a different
type, but the compiler and runtime have no such idea. So the burden of
the assumption is on the user.
Raw data writes that take arrays could be allowed to accept void[] if
implicit conversion from T[] is desirable.
Andrei
More information about the Digitalmars-d
mailing list