std.string will get the boot

Lionello Lunesu lio at lunesu.remove.com
Mon Feb 1 18:07:07 PST 2010


On 31-1-2010 16:34, Simen kjaeraas wrote:
> Lionello Lunesu <lio at lunesu.remove.com> wrote:
> 
>> I miss typedef. I think this is exactly what typedef was intended
>> for. Perhaps we can reintroduce it as a 'short hand' for such a
>> struct?
> 
> struct Typedef( T ) {
>   T payload;
>   alias payload this;
> }
> 
> Usage:
> 
> alias Typedef!( int ) myInt;
> 
> Is this what you want?

Using alias you loose all type safety.

I remember Andrei mentioned that he and Walter couldn't agree
whether typedef should behave as a sub or super class. I think it
should not be looked at from a inheritance perspective, but just
consider it as wrapper struct with a ctor that takes the
underlying type.

>> By the way, ASCII is a subset of UTF-8 (that was the whole
>> point), so there's no reason why 'char[]' can't still be used for
>> ASCII strings, right?
> 
> AS far as I have understood (I am no Unicode guru), in some locales
> toUpper and toLower map ASCII chars to non-ASCII chars. So ASCII being a
> strict subset of UTF-8 is not always true.
> 

True, but then that upper resp lowercase would no longer be
ASCII. As long as you stick to ASCII, char[] should work just fine.

So, toLower and toUpper can accept ASCII char[] but always output
one of those new char ranges. Problem fixed :)

L.



More information about the Digitalmars-d mailing list