On 09/03/2012 08:01 PM, David Nadlinger wrote:
On Monday, 3 September 2012 at 14:04:18 UTC, Andrei Alexandrescu wrote:
A sufficiently smart compiler (tm) could
optimize this to a efficient string "prefix switch statement" just as
well…

I agree. But then http://c2.com/cgi/wiki?SufficientlySmartCompiler.

This is exactly my point: My feeling is that the increased complexity

What complexity?

by introducing a second syntax resp. a new special case (i.e. among) for
such a simple operation is only worth it if it leaves no reason to
revert to a hand-written replacement for performance reason,

[ ].canFind( ) allocates on the GC heap without a sufficiently smart compiler.

and I'm not sure if the signature taking runtime parameters is enough for that
(without assuming such a sufficiently smart compiler).

David

Reply via email to