http://d.puremagic.com/issues/show_bug.cgi?id=11430

           Summary: A simpler overload for std.file.slurp
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from [email protected] 2013-11-03 07:33:34 PST ---
I think it could be handy to add another overload of the std.file.slurp
template function. Currently (dmd 2.064) this is its usage syntax (using UFCS
for the file name), that essentially states the types two times:

const arr1 = "data.txt".slurp!(int, int)("%d, %d");


If the user wants to state them only once (more DRY) then slurp could also
accept:

const arr2 = "data.txt".slurp!"%d, %d";

This is not a replacement for the precedent syntax because the formatting
syntax is less precise ("%d %f" can only take an int and a double, so with this
syntax you can't specify a long and a real), but in many common cases I think
it's enough and it's simpler.


(In theory the API of slurp could even change, returning a lazy range, useful
for larger files.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to