Stupid little iota of an idea

spir denis.spir at gmail.com
Wed Feb 9 06:14:21 PST 2011


On 02/09/2011 01:54 PM, Nick Sabalausky wrote:
> "spir"<denis.spir at gmail.com>  wrote in message
> news:mailman.1423.1297254917.4748.digitalmars-d at puremagic.com...
>>
>> PS: your proposal would also logically allow, I guess, expressions like (n
>> in min..max). Would love it.
>>
>
> Unfortunately, not unless "in" was changed to allow "{expr} in {range}". And
> from prior discussions of "in", I seem to remember Walter and Andrei are
> strongly against allowing "in" to be used to check for element values rather
> than just AA keys.
>
> But Andrei did recently propose an "any", IIRC, that would allow something
> like what you're suggesting.

IIRC, they did not argue against it for ranges specifically, but for it beeing 
O(n) for conceptually sequential collections like plain arrays, unlike for AAs, 
thus misleading in terms of efficiency. But 'in' is O(1) for an interval ;-) 
So, there is no reason to disallow it, instead such a feature would be both 
obvious & useful.

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list