On Wednesday, December 28, 2011 19:25:15 Jakob Ovrum wrote: > Also, 'in char[]', which is conceptually much safer, isn't that > much longer to type. > > It would be cool if 'scope' was actually implemented apart from > an optimization though.
in char[] is _not_ safer than immutable(char)[]. In fact it's _less_ safe. Itals also far more restrictive. Many, many functions return a portion of the string that they are passed in. That slicing would be impossible with scope, and because in char[] makes no guarantees about the elements not changing after the function call, you'd often have to dup or idup it in order to avoid bugs. immutable(char)[] avoids all of that. You can safely slice it without having to worry about duping it to avoid it changing out from under you. - Jonathan M Davis
