Other language features you'd want in D
Jari-Matti Mäkelä
jmjmak at utu.fi.invalid
Thu Feb 28 06:22:21 PST 2008
On Thu, 28 Feb 2008, bearophile wrote:
> downs:
>> so ["foo", "bar"] should be char[3][2], as currently, but ["foo", "barf"] should use
>> char[][2] automatically,
>
> Too much automatic things may lead to problems. I don't like that too much.
> I'd like a more systematic (uniform) behavior there (for example:
> "always create dynamic array when not explicitly specified otherwise").
Having the most general case as default is easier to remember. But if one
writes:
char[3][2] foo = [ "foo", "bar" ];
it should still be able to unify the types. Having the opposite as default
is annoying since it can lead to subtle bugs. I once had an array of
strings that worked just fine with Stdout() (in tango), but FilePath
couldn't find the file. Even strace couldn't reveal the bug. But adding
missing []s fixed it.
>
> Bye,
> bearophile
>
More information about the Digitalmars-d
mailing list