| Thread overview | |||||||
|---|---|---|---|---|---|---|---|
|
January 25, 2014 [Issue 5530] std.algorithm.len() | ||||
|---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=5530 Peter Alexander <peter.alexander.au@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |peter.alexander.au@gmail.co | |m --- Comment #1 from Peter Alexander <peter.alexander.au@gmail.com> 2014-01-25 14:00:32 PST --- What's wrong with `walkLength`? If the range has `.length` (and isn't a narrow string) then walkLength just returns .length -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- | ||||
January 25, 2014 [Issue 5530] std.algorithm.len() | ||||
|---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=5530 --- Comment #2 from bearophile_hugs@eml.cc 2014-01-25 15:10:22 PST --- (In reply to comment #1) > What's wrong with `walkLength`? Its semantics and performance are different for narrow strings, that are common use case. len is O(1), walkLength is sometimes O(n). -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- | ||||
January 25, 2014 [Issue 5530] std.algorithm.len() | ||||
|---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=5530 --- Comment #3 from Peter Alexander <peter.alexander.au@gmail.com> 2014-01-25 15:31:05 PST --- (In reply to comment #2) > (In reply to comment #1) > > What's wrong with `walkLength`? > > Its semantics and performance are different for narrow strings, that are common > use case. len is O(1), walkLength is sometimes O(n). So am I right in saying that your proposed 'len' function would return .length for narrow strings? If that's the case then it would be a glaring inconsistency with the rest of Phobos, which has been very careful to treat strings as ranges of code points, and not code units. Having a single function break consistency for the sake of a few characters of typing convenience doesn't seem like a sensible thing to do. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- | ||||
January 25, 2014 [Issue 5530] std.algorithm.len() | ||||
|---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=5530 Andrei Alexandrescu <andrei@erdani.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |andrei@erdani.com Resolution| |WONTFIX --- Comment #4 from Andrei Alexandrescu <andrei@erdani.com> 2014-01-25 15:44:52 PST --- I understad the motivatio, but it's not nearly enough to justify a synonim for length. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- | ||||
January 25, 2014 [Issue 5530] std.algorithm.len() | ||||
|---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=5530 --- Comment #5 from Andrei Alexandrescu <andrei@erdani.com> 2014-01-25 15:45:31 PST --- Sorry for the spelling errors - keyboard is acting up. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply