digitalmars.D.learn - Why does the example on page 8 of TDPL work without importing std.algorithm
- Bryce Watkins (10/10) Jan 03 2011 Hi all,
- Ellery Newcomer (3/7) Jan 03 2011 If you're importing some other phobos module, I would guess an instance
- Lars T. Kyllingstad (7/13) Jan 04 2011 That's right. std.string does a public selective import of startsWith()...
- Bryce Watkins (6/19) Jan 04 2011 Thanks now I understand, this also means that the example on page 8 only...
Hi all, Can someone explain this to me please? I have been trying to understand why you would use splitter over split between the examples on page 8 and page 12, as an errata has been posted: http://erdani.com/tdpl/errata/index.php?title=Main_Page which states that splitter should be used for better efficiency. However when I use splitter in my code it works without having imported std.algorithm. Thanks, Bryce.
Jan 03 2011
If you're importing some other phobos module, I would guess an instance of this bug: http://d.puremagic.com/issues/show_bug.cgi?id=314 On 01/03/2011 10:56 AM, Bryce Watkins wrote:However when I use splitter in my code it works without having imported std.algorithm. Thanks, Bryce.
Jan 03 2011
On Mon, 03 Jan 2011 17:18:34 -0600, Ellery Newcomer wrote:If you're importing some other phobos module, I would guess an instance of this bug: http://d.puremagic.com/issues/show_bug.cgi?id=314 On 01/03/2011 10:56 AM, Bryce Watkins wrote:That's right. std.string does a public selective import of startsWith() and endsWith() from std.algorithm, and bug 314 causes the whole module to be imported publically. 314 is a huge, gaping hole in the module system. AFAIK, it's a high- priority bug, but also one that is very difficult to fix for some reason. -LarsHowever when I use splitter in my code it works without having imported std.algorithm.
Jan 04 2011
On 4/01/2011 9:26 p.m., Lars T. Kyllingstad wrote:On Mon, 03 Jan 2011 17:18:34 -0600, Ellery Newcomer wrote:Thanks now I understand, this also means that the example on page 8 only works because of bug 314, and should this bug ever be fixed then the example code will break. Therefore it really should include an import of std.algorithm explicitly for both clarity and long term reliability. Bryce.If you're importing some other phobos module, I would guess an instance of this bug: http://d.puremagic.com/issues/show_bug.cgi?id=314 On 01/03/2011 10:56 AM, Bryce Watkins wrote:That's right. std.string does a public selective import of startsWith() and endsWith() from std.algorithm, and bug 314 causes the whole module to be imported publically. 314 is a huge, gaping hole in the module system. AFAIK, it's a high- priority bug, but also one that is very difficult to fix for some reason. -LarsHowever when I use splitter in my code it works without having imported std.algorithm.
Jan 04 2011