Fastest Way of Accessing Entries in an AA
ketmar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jan 8 22:37:07 PST 2015
On Thu, 08 Jan 2015 23:06:38 +0000
"Nordlöw" via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
wrote:
> On Thursday, 8 January 2015 at 16:11:07 UTC, ketmar via
> Digitalmars-d-learn wrote:
> > how can it? compiler doesn't know what the code is supposed to
> > do. if
> > compilers will know such things someday, we can stop writing
> > programs
> > altogether, as compilers will be able to write any program for
> > us. ;-)
>
> Correction:
>
> I thought it would be nice if the compiler explained to me that
>
> key in aa ? aa[key]
>
> is a sub-optimal performance-wise.
although it's right in most cases, it's still implying that compiler is
able to understand the code behind `in` and `[key]`, as they aren't
built into the compiler, but rather coded in druntime. producing
warning on such code can create wrong impression about compiler code
analysing abilities.
this time i think that it's a work for a linter, 'cause there is
nothing wrong with the code, it's just a questionable style. so let
linter question it. ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150109/a574dc7b/attachment.sig>
More information about the Digitalmars-d-learn
mailing list