Scope modules DIP rough messy draft.
12345swordy
alexanderheistermann at gmail.com
Sat Oct 27 04:13:40 UTC 2018
On Saturday, 27 October 2018 at 02:07:56 UTC, luckoverthere wrote:
> Why do "one time scripts" need this feature?
To avoid writing multiple files.
> D is less restrictive than C++, because it is less restrictive
> you don't need to refactor. There also is no equivalent
> "friend" feature in D. Since you are just copying and pasting
> code, for the most part, where are you going to accidentally
> call a private function you weren't calling before in C++ that
> you are now going to call in D.
It does not necessarily involve friend functions. If your c++
code rely on the class is a unit of encapsulation as part of your
design, then switching to d breaks that design as the module
itself is the unit of encapsulation. You have to refactor your
code by putting each class in its own file.
>> Rapidly creating a program that involves multiple modules
>> requires multiple files for it, which can cause the slow down
>> the coding process, most noticeably in coding competition.
> Why would you be worried about encapsulation in a coding
> competition, most likely the fastest code aren't going to be
> following any sort of best practice as the fastest code will
> probably be using some crazy hacks anyways.
That is more of a a broad objection to encapsulation in coding
competition then the feature presented at the dip itself.
> If it is a simple small program, then why require private at
> all?
That the design that the programmer decides on.
More information about the Digitalmars-d
mailing list