It's just a thought because a lot of the time, using length will get the right answer, but for the wrong reasons, resulting in lurking bugs. You can always cast to immutable(ubyte)[] or immutable(short)[] if you want to work with the actual bytes anyway.
I'm writing an introduction/tutorial to using strings in D,
paying particular attention to the complexities of UTF-8 and 16.
I realised that when you want the number of characters, you
normally actually want to use walkLength, not length. Is is
reasonable for the compiler to pick this up during semantic
analysis and point out this situation?
- Notice/Warning on narrowStrings .length James Miller
- Re: Notice/Warning on narrowStrings .length Adam D. Ruppe
- Re: Notice/Warning on narrowStrings .length bearophile
- Re: Notice/Warning on narrowStrings .length James Miller
- Re: Notice/Warning on narrowStrings .length bearophile
- Re: Notice/Warning on narrowStrings .length Jonathan M Davis
- Re: Notice/Warning on narrowStrings .length Nick Sabalausky
- Re: Notice/Warning on narrowStrings .length Jonathan M Davis
- Re: Notice/Warning on narrowStrings .length H. S. Teoh
- Re: Notice/Warning on narrowStrings .length Nick Sabalausky
- Re: Notice/Warning on narrowStrings .length Nick Sabalausky
