digitalmars.D.bugs - [Issue 8839] New: MmFile do not use Range
- d-bugmail puremagic.com (23/23) Oct 17 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8839
- d-bugmail puremagic.com (13/13) Oct 17 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8839
- d-bugmail puremagic.com (8/8) Oct 17 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8839
- d-bugmail puremagic.com (12/15) Oct 17 2012 I don't know what you mean.
- d-bugmail puremagic.com (12/12) Oct 18 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8839
- d-bugmail puremagic.com (19/21) Oct 18 2012 Yeah. And arrays have that via std.array.empty, std.array,front, and
- d-bugmail puremagic.com (7/7) Oct 23 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8839
- d-bugmail puremagic.com (10/10) Oct 30 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8839
- d-bugmail puremagic.com (16/16) Oct 30 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8839
- d-bugmail puremagic.com (14/14) Oct 30 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8839
- d-bugmail puremagic.com (11/11) Oct 30 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8839
- d-bugmail puremagic.com (11/11) Oct 30 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8839
http://d.puremagic.com/issues/show_bug.cgi?id=8839 Summary: MmFile do not use Range Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: bioinfornatics gmail.com 13:51:31 PDT --- Dear, In first i explain why this module is important to me: i would like use mmfile as in bioinformatic file are really huge and this technology should be faster than classical way But they are two problems: - any example , documentation or whatever … - MmFile do not use Range -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 17 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8839 Jonathan M Davis <jmdavisProg gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg gmx.com PDT --- It works just fine with ranges. Just slice it to get an array over the mapped memory. I've done it before, and it worked great. Essentially, MmFile is acting like a container rather than a range and therefore provides range access to what it contains rather than being a range itself. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 17 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8839 15:48:54 PDT --- yes but it use opSlice method to do this not - front back safe … In more why it is a class instead a struct ? MmFile do not use inheritance -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 17 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8839 PDT ---yes but it use opSlice method to do this not - front back safe …I don't know what you mean.In more why it is a class instead a struct ? MmFile do not use inheritanceIt shouldn't be IMHO, but changing it would be a breaking change, so I wouldn't expect it to be changed. I don't know why it was made a class in the first place, but per the copyright, it looks like it came from D1 originally, and the language could have changed quite a bit since MmFile was created, and it may be that it made more sense at the time to make it a class, but I really don't know. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 17 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8839 15:31:12 PDT --- I mean a Phobos range as InputRange: requires the empty, front and popFront() member functions more info here: http://ddili.org/ders/d.en/ranges.html so a little question that is faster to - read byte one by one - take a sub range by example 80 byte by 80 by using slicing thanks -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 18 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8839 PDT ---I mean a Phobos range as InputRange: requires the empty, front and popFront() member functionsYeah. And arrays have that via std.array.empty, std.array,front, and std.array.popFront. So, the array that you get from slicing MmFile is a fully functional range. It's even random-access with slicing and length, so it supports pretty much every range-based function there is. Making MmFile itself a range wouldn't gain you anything. And in fact, making it a range would be a _bad_ idea for the same reason that making any container a range is a bad idea - iterating over it would consume it. You wouldn't want to do something like auto mmFile = new MmFile("filename"); mmFile.popFront(); After that call to popFront, you would no longer have access to the first byte of the file without creating a new MmFile, which is almost certainly not what you want. Rather, what you really want is a range which contains all of the bytes in the file and allows you to operate on them without affecting MmFile, and slicing MmFile to get an array works great for that. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 18 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8839 12:19:39 PDT --- i totally agree with you now :-) but one day it will good to switch Mmfile to struct that is not huge break -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 23 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8839 16:05:44 PDT --- Since slicing use void[] as return type instead ubyte you can't use UFCS you need to cast it length member should be maybe size_t i think design this module should be a good thing. If you break something is a minor break but you will get a better mmFile -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 30 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8839 PDT --- If you need to cast the slice to ubyte[], then cast it to ubyte[]. Given that it's operating on memory, it's probably better that it use void[] rather than ubyte[]. Regardless, given the increased resistance from Walter and Andrei to any kind of breaking changes, breaking changes are going to need a very good reason (and if anything, minor ones are more likely to be rejected, because you get code breakage whether the change is large or small, and you generally get less benefit from minor changes). Given the chance, I'd definitely like to adjust a few things in MmFile, but I'm not sure that we can at this point, and while some minor adjustments would be nice, as far as I know, there's nothing seriously wrong with MmFile, so as nice as some changes might be, they're not really needed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 30 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8839 16:26:08 PDT --- about breaking change i understand is important to D to get an api "more stable" about ufcs: -> do not works _file[_currentPosition .. _file.length] .countUntil!( ( a ) => isWhite( cast(dchar) a ) ); -> works countUntil!( ( a ) => isWhite( cast(dchar) a ) ) ( cast(ubyte[]) _file[_currentPosition .. _file.length] ); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 30 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8839 PDT --- Then save the range as a variable and use UFCS on that, or this would probably work: (cast(ubyte[])_file[_currentPosition .. _file.length]).countUntil!(a => isWhite(a))(); I really don't see not being able to use UFCS on the slice directly as a big deal. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 30 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8839 16:40:25 PDT --- for me that is ok but for new developer it could be little confused since in first it will try the common ufcs approach. It will get a strange template error about as void[] is used as return type. It will spent some time before fond a way as in this special case he need to cast it. So for me is ok but for others maybe add a little example with a ufcs approach to help him ;-) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 30 2012