Palindromes
Brad Anderson via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Dec 3 17:57:09 PST 2015
On Friday, 4 December 2015 at 00:50:17 UTC, Meta wrote:
> On Friday, 4 December 2015 at 00:26:23 UTC, Jim Barnett wrote:
>> On Friday, 4 December 2015 at 00:23:45 UTC, Jim Barnett wrote:
>>> The `import` statement inside the `for`-loop kind of smells
>>> to me.
>>>
>>
>> Sorry, inside the `while` loop
>
> In D it's considered idiomatic, but it can also cause some very
> hard to detect errors from time to time... I hate it for this
> reason and never do it in my own code.
Inside a while, I don't think, really matches the idiom's goals.
By only sticking imports inside the code that makes use of them
you can achieve (I've never measured it though) compilation
performance improvements in code that then imports the containing
module but never makes use of the code in question. Sticking the
import in the middle of the code is just noisy though, you want
it nearby with limited scope but otherwise out of the way.
More information about the Digitalmars-d-learn
mailing list