Relaxing the definition of isSomeString and isNarrowString

monarch_dodra via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 25 15:04:33 PDT 2014


On Monday, 25 August 2014 at 21:11:52 UTC, Andrei Alexandrescu 
wrote:
> That escalated quickly. Chillax.

Sorry. It's just that I've been seeing this claim way too much 
frequently, especially in learn, where there have been too many 
threads about trying to avoid decoding. Most often, for the wrong 
reasons.

> The use of that enum array is fine but somewhat fragile - a 
> small refactoring may trigger an allocation.

Declaring it as a simple 4-member TypeTuple would iliminate the 
(potential) issue, as a TT *can't* be runtime indexed. Seems like 
a good compromise.

> Trying a static immutable array may be in order.

That would actually create an object, and potentially prevent 
optimizations (I think, maybe). The TT seems cleaner to me 
anyways. I'll create a pull for it.


More information about the Digitalmars-d mailing list