Proposed Phobos equivalent of wcswidth()

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Jan 15 19:52:07 UTC 2018


On Sat, Jan 13, 2018 at 09:26:52AM -0800, H. S. Teoh via Digitalmars-d wrote:
[...]
> 	https://github.com/quickfur/strwidth
[...]

One thing I'm seeking help with, and this is mainly directed at Dmitry
Olshansky but can be anyone here who knows the internal workings of
std.uni well enough, is how to transform the Trie generated by the
static ctor into compile-time TrieNode declarations.  This is one
blocker for my turning this code into a Phobos PR, because I don't want
to incur the cost of initializing this trie at runtime.

Also, on a related note, there exist nicer interfaces in std.uni for
constructing Tries that map ranges of codepoints to non-boolean values,
but none of these are available publicly.  The current implementation in
strwidth only uses the public API of std.uni, so the construction of the
trie is pretty horrendous (looping over individual codepoints and
creating an AA of individual codepoints -- including very large ranges
like the entire Unicode plane 2).  I wonder if some of these facilities
should be made public so that user code that needs to construct
codepoint tries that include large ranges of codepoints can do so more
efficiently.


T

-- 
This sentence is false.


More information about the Digitalmars-d mailing list