Hello Andrei,

Vladimir Panteleev wrote:

This isn't about performance, this is about having one thousand casts
all over my code. It becomes a burden to cast everything to ubyte[]
when working with abstract binary data. For example, when building a
MIME multipart message with binary fields, every line needs to have a
cast in it - when we could have just used the ~= operator to append
to a void[].

Another alternative would be to allow implicitly casting arrays of any
type to const(ubyte)[] which is always safe.

sounds like something that might work.
But I think this is too
much ado about nothing - you're avoiding the type system to start
with,

I'm not sure he is (or at least, he is in a very well defined way; "I need to look at this data as its bytes")

so use ubyte, insert a cast, and call it a day. If you have too
many casts, the problem is most likely elsewhere

You might be correct, but I don't think any of us have enough info right now to make that assertion.

Reply via email to