[Issue 14704] The design, which allows not to write import, import, import ... for selective imports

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 17 11:00:34 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14704

--- Comment #11 from dennis.m.ritchie at mail.ru ---
(In reply to Ketmar Dark from comment #9)
> you know what? people invented a great thing called "library", so you can
> move the code you're using in various places to the library and stop
> copypasting it everywhere.

You understand that a huge number of serious programming contests are not
allowed to use the internet, so your option to copypasting disappears.

> and yoy know what else is interesting? i found myself stop doing bulk
> imports. it's way easier to write a qualified import right in the code block
> where you need that, and import only the things you need. bulk imports is a
> sign of bad design. stop doing that, local imports rox. your multiline
> sample should be burned with fire.

Yes, I agree that local imports are very comfortable in the production code
(though not always):
https://github.com/D-Programming-Language/phobos/blob/master/std/algorithm/sorting.d#L66-L71

But another thing Olympiad programming. Contests are very common, so all write
multidimensional imports to not bathe for nothing :)

(In reply to Ketmar Dark from comment #10)
> p.s. to have your #7 right, do "s/programmer/code monkey/" on it.

Alas, most programmers are `code monkeys`, so I'm right! :)

--


More information about the Digitalmars-d-bugs mailing list