On 31-1-2010 16:34, Simen kjaeraas wrote: > Lionello Lunesu <[email protected]> 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.
