standard ranges
Steven Schveighoffer
schveiguy at yahoo.com
Wed Jun 27 13:22:21 PDT 2012
On Wed, 27 Jun 2012 15:20:26 -0400, Timon Gehr <timon.gehr at gmx.ch> wrote:
> There is no reason for anyone to be confused about this endlessly. It
> is simple to understand. Furthermore, think about the implications of a
> library-defined string type: it just introduces the problem of what the
> type of built-in string literals should be. This would cause endless
> pain with type deduction, ifti, string mixins, ... A library-defined
> string type cannot be a full string type. Pretending that it can has no
> value.
Default type of the literal should be the library type. If you want
immutable(char)[], use "abc".codeunits or equivalent.
Of course, it should by default work as a zero-terminated char * for C
compatibility.
The current situation is not simple to understand. Generic code that
accepts arrays has to special-case narrow-width strings if you plan to use
phobos with them in some cases. That is a horrible situation.
> alias immutable(char)[] string is just fine.
That is technically fine, but if phobos wants to treat immutable(char)[]
as something other than an array, it is not fine.
-Steve
More information about the Digitalmars-d
mailing list