RFC: naming for FrontTransversal and Transversal ranges

Daniel Keep daniel.keep.lists at gmail.com
Wed Apr 29 18:13:42 PDT 2009



Andrei Alexandrescu wrote:
> A lot of interesting stuff.

POLS (Principle of Least Surprise) says they should be reference types.
 That's what C, C++ (T[] doesn't look like it's using STL), C#, Java,
Lua, Python, etc., etc. programmers will expect.  Jumping out from
behind a bush a surprising them with value semantics will probably not
impress them.

And don't say you can just document it: we get enough people coming in
who refuse to read the docs until we tell them to.  :P

That said, having a Value!T template [1] that implements value-semantics
would be good.  I'll be honest with you: I'm not sure I'd use it for
fear of performance issues.

Perhaps making it a copy-on-write type under the hood would help with
that ("it only copies if you mutate and someone else has a reference;
it's fast AND safe!").

  -- Daniel


[1] I'd be tempted to call it Block!T as in "here's a block of data".



More information about the Digitalmars-d mailing list