Tricky semantics of ranges & potentially numerous Phobos bugs

monarch_dodra monarchdodra at gmail.com
Wed Oct 17 00:23:09 PDT 2012


On Tuesday, 16 October 2012 at 23:14:01 UTC, Jonathan M Davis 
wrote:
>
> - Jonathan M Davis

Crazy idea:

Can't we just have a "byLineDeep" or "byLineSafe", but that 
returns actual deep copied immutable strings?

This way, "byLineDeep" is 100% safe, no tricks involved. Ranges 
are not made any more complicated then they already are.

Then, mark "byLine" as "potentially unsafe, but faster. May fail 
if used in an algorithm. Meant for manual iteratation. use at 
your own risk". Then, anybody who *knows* what he is doing can go 
for it.

Of course, I'd have preferred the naming to be the other way 
around (safe by default, unsafe on demand), but things are as 
they are (maybe).

----

I know I may not be used to using "byLine" yet, but the sole fact 
that it returns a "char[]" as opposed to a "string" as been an 
infinite source of frustration for me.

I'd *gladly* take a 4x penalty hit on something I won't even see 
anyway, if it means I can forget about having to worry about god 
damned aliased buffers.


More information about the Digitalmars-d mailing list