Ready for review: new std.uni

Dmitry Olshansky dmitry.olsh at gmail.com
Sat Jan 12 08:26:20 PST 2013


12-Jan-2013 20:16, H. S. Teoh пишет:
> On Sat, Jan 12, 2013 at 12:20:46PM +0400, Dmitry Olshansky wrote:
>> 12-Jan-2013 05:31, Walter Bright пишет:
>>> On 1/11/2013 4:14 PM, H. S. Teoh wrote:
>>>> Would an alias be appropriate in this case, so that we can put a
>>>> concrete name to the function return type? Or is that an abuse of
>>>> alias?
>>>
>>> Actually, that sounds like a good idea.
>>>
>>
>> Except that it's created out of template parameters by wrapping them
>> in a couple of template. So not, can't do.
> [...]
>
> I was going to suggest something like:
>
> 	alias typeof(return) ConcreteName;
>
> But then I realized it's impossible to use ConcreteName in the function
> signature, which makes it pointless to have the alias since it won't
> show up in the Ddoc. :-(
>
> Although, maybe something like this *might* be possible (but it's sorta
> getting to the point of being ridiculously complex just for the sake of
> making ddoc display a single identifier):
>
> 	template ConcreteName(A,B,C) {
> 		alias ConcreteName = SomeTemplate!(A, OtherTemplate!B, ...);
> 	}
>
> 	ConcreteName!(A,B,C) func(A,B,C,D)(D args) {
> 		ConcreteName!(A,B,C) retVal = ...;
> 		return retVal;
> 	}

For basic needs there are 2 alias for custom Tries that map dchar -> 
bool and dchar -> some integer.

http://blackwhale.github.com/phobos/uni.html#CodepointSetTrie
http://blackwhale.github.com/phobos/uni.html#CodepointTrie

Both accept custom selection of bits per Trie level. The docs are not 
really helpful in this area yet. I'll make another pass and add more 
examples, glossary and so on.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list