std.algorithm.remove and principle of least astonishment
Michel Fortin
michel.fortin at michelf.com
Mon Nov 22 08:43:17 PST 2010
On 2010-11-22 10:37:48 -0500, "Steven Schveighoffer"
<schveiguy at yahoo.com> said:
> BTW, you may not understand that we don't want to go back to the days
> of 'byDchar'. We want strings (including literals) to be special type
> because they are a special type (not an array).
It's amusing to read this from my perspective.
In my project where I'm implementing the Objective-C object model, I
implemented literal Objective-C strings a few days ago. It's basically
a fourth string type understood by the compiler that generates a static
NSString instance in the object file. String literals with no explicit
type are implicitly converted whenever needed, so it really is painless
to use:
NSString str = "hello"; // implicit conversion, but only for
compile-time constants
Here you have your NSString, all stored as static data, no memory
allocation at all.
So you now have your special string type that works with literals and
is not an array. But it's Cocoa-only.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list