Curl wrapper

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue May 17 11:11:11 PDT 2011


On 5/17/11 1:00 PM, Vladimir Panteleev wrote:
> On Tue, 17 May 2011 20:43:11 +0300, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>
>> On 5/17/11 12:39 PM, Vladimir Panteleev wrote:
>>> On Tue, 17 May 2011 17:45:00 +0300, Andrei Alexandrescu
>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>
>>>> On 5/17/11 12:23 AM, Vladimir Panteleev wrote:
>>>>> On Tue, 17 May 2011 07:43:06 +0300, Andrei Alexandrescu
>>>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>>>
>>>>>> 3. Data on wire is ubyte[], not void[].
>>>>>
>>>>> I was the one who suggested using void[]. If data on wire is ubyte[],
>>>>> why is data on disk void[] (according to std.file.read/write)?
>>>>
>>>> Bug in std.file.
>>>
>>> I remember suggesting a long time ago that all types that do not have
>>> pointers be implicitly convertible to ubyte[]. That way, write functions
>>> can safely use ubyte[] without casts (and even provide a bit of safety
>>> against accidentally writing pointers to disk or network). Are you still
>>> against the idea?
>>
>> Yes. The problem is that converting a type implicitly to ubyte[]
>> allows anyone to write raw bytes into an object, making a hash of any
>> type system guarantees without a cast in sight. That is, granted,
>> memory-safe (because there are no indirections), but is not
>> recommendable.
>
> Ah, of course.
>
> const(ubyte)[] ? :)

Yah, const(ubyte)[] is much more reasonable. We may as well add a 
function representation() that returns it for any object.

Andrei


More information about the Digitalmars-d mailing list