Thread overview | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 17, 2012 [Issue 8839] New: MmFile do not use Range | ||||
---|---|---|---|---|
| ||||
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 --- Comment #0 from bioinfornatics <bioinfornatics@gmail.com> 2012-10-17 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: ------- |
October 17, 2012 [Issue 8839] MmFile do not use Range | ||||
---|---|---|---|---|
| ||||
Posted in reply to bioinfornatics | http://d.puremagic.com/issues/show_bug.cgi?id=8839 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg@gmx.com --- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-10-17 15:26:14 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: ------- |
October 17, 2012 [Issue 8839] MmFile do not use Range | ||||
---|---|---|---|---|
| ||||
Posted in reply to bioinfornatics | http://d.puremagic.com/issues/show_bug.cgi?id=8839 --- Comment #2 from bioinfornatics <bioinfornatics@gmail.com> 2012-10-17 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: ------- |
October 17, 2012 [Issue 8839] MmFile do not use Range | ||||
---|---|---|---|---|
| ||||
Posted in reply to bioinfornatics | http://d.puremagic.com/issues/show_bug.cgi?id=8839 --- Comment #3 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-10-17 16:41:29 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 inheritance It 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: ------- |
October 18, 2012 [Issue 8839] MmFile do not use Range | ||||
---|---|---|---|---|
| ||||
Posted in reply to bioinfornatics | http://d.puremagic.com/issues/show_bug.cgi?id=8839 --- Comment #4 from bioinfornatics <bioinfornatics@gmail.com> 2012-10-18 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: ------- |
October 18, 2012 [Issue 8839] MmFile do not use Range | ||||
---|---|---|---|---|
| ||||
Posted in reply to bioinfornatics | http://d.puremagic.com/issues/show_bug.cgi?id=8839 --- Comment #5 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-10-18 16:14:42 PDT --- > I mean a Phobos range as > InputRange: requires the empty, front and popFront() member functions Yeah. 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: ------- |
October 23, 2012 [Issue 8839] MmFile do not use Range | ||||
---|---|---|---|---|
| ||||
Posted in reply to bioinfornatics | http://d.puremagic.com/issues/show_bug.cgi?id=8839 --- Comment #6 from bioinfornatics <bioinfornatics@gmail.com> 2012-10-23 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: ------- |
October 30, 2012 [Issue 8839] MmFile do not use Range | ||||
---|---|---|---|---|
| ||||
Posted in reply to bioinfornatics | http://d.puremagic.com/issues/show_bug.cgi?id=8839 --- Comment #7 from bioinfornatics <bioinfornatics@gmail.com> 2012-10-30 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: ------- |
October 30, 2012 [Issue 8839] MmFile do not use Range | ||||
---|---|---|---|---|
| ||||
Posted in reply to bioinfornatics | http://d.puremagic.com/issues/show_bug.cgi?id=8839 --- Comment #8 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-10-30 16:13:14 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: ------- |
October 30, 2012 [Issue 8839] MmFile do not use Range | ||||
---|---|---|---|---|
| ||||
Posted in reply to bioinfornatics | http://d.puremagic.com/issues/show_bug.cgi?id=8839 --- Comment #9 from bioinfornatics <bioinfornatics@gmail.com> 2012-10-30 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: ------- |
Copyright © 1999-2021 by the D Language Foundation