www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - byLine/byLineCopy deprecation?

reply "bearophile" <bearophileHUGS lycos.com> writes:
I have had few bugs caused by byLine not copying the line on 
default. Now we have byLineCopy, but sometimes I forget to use 
it. In D I prefer unsafe functions to be on request, and safe 
ones by default.

Originally I suggested to give to byLine a boolean template 
argument named "doCopy" that is true on default and can be set to 
false for performance:

https://d.puremagic.com/issues/show_bug.cgi?id=4474

So can we deprecate byLine and introduce something with a short 
name that is safer and something with a longer name that is 
faster (or probably better use just one function with the doCopy 
boolean template argument set to true by default).

A possible name for such function is "byRow!(bool doCopy=true, 
.....)" and then slowly deprecate byLine and byLineCopy.

Bye,
bearophile
Oct 10 2014
parent ketmar via Digitalmars-d <digitalmars-d puremagic.com> writes:
On Fri, 10 Oct 2014 11:49:05 +0000
bearophile via Digitalmars-d <digitalmars-d puremagic.com> wrote:

 A possible name for such function is "byRow!(bool doCopy=3Dtrue,=20
 .....)" and then slowly deprecate byLine and byLineCopy.
i think it should be better to use less generic type as template argument. something like `byRow!Copying.Yes`. it's unnecessary annoying to remember if `true` means "do copying" or "don't do copying". ;-)
Oct 10 2014