A few notes on choosing between Go and D for a quick project

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Sun Mar 15 17:32:04 PDT 2015


On Sun, Mar 15, 2015 at 05:12:55PM -0700, Walter Bright via Digitalmars-d wrote:
> On 3/15/2015 4:06 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm at gmx.net>" wrote:
> >This I agree with. Their usefulness is also greatly diminished by
> >them being strings, instead of byte (ubyte?) arrays. When would you
> >actually want to write a string (= text) using hex notation?
> 
> 1. test data

This is about the only valid use case I can think of. And it's really
only useful in druntime/Phobos test cases. I can't imagine users would
go out of their way to use generate binary test data where string input
is desired.


> 2. strings that aren't in UTF format

Uhm... strings that aren't in UTF format really ought to be ubyte[]
(resp. ushort[], uint[]), not string, because pretty much everything in
D that takes a (|w|d)string argument expects UTF encoding.

(Or, in an ideal world where std.encoding is actually sane, we'd use
suitable wrapper types for ubyte[] that represent their respective
encoding.)


> 3. strings with other data embedded in them

Again, shouldn't these be ubyte[]? Calling them string (i.e.
immutable(char)[]) is a wrong conflation of ubyte with char, that has
led to so much headache in C/C++. D should not repeat this mistake.


T

-- 
English has the lovely word "defenestrate", meaning "to execute by throwing someone out a window", or more recently "to remove Windows from a computer and replace it with something useful". :-) -- John Cowan


More information about the Digitalmars-d mailing list