Stricter protection attributes for students

Jacob Carlborg doob at me.com
Tue Jun 1 04:05:12 PDT 2010


On 2010-06-01 03:47, bearophile wrote:
> D2 is quite complex, so it's not the best language to teach programming, but I think it can be used for this purpose too, for example by university students that already know basic programming in "simpler" languages (like Python).
>
> Such students that need to learn OOP probably need to learn to use protection accessibility attributes too, as public, private, protected. Learning how to use them comes from programming practice.
>
> But here I think there is a problem in D, because D2 seems "sloppy" about them. Some of such lack of rigour is by design (like all fields and methods are friends inside a module), some part can come from bugs (like http://d.puremagic.com/issues/show_bug.cgi?id=1161  but I think there are other similar bugs), and some from other causes (maybe the D compiler is just not doing some sanity tests on protection attributes, and such omissions aren't even in Bugzilla yet).
>
> If you program some time in C# you can feel the compiler is much stricter regarding public, private, protected, and this difference makes you learn their usage *much* more efficiently/faster/better. So I think this part of D has to improve and get stricter for those future students too :-)
>
> Bye,
> bearophile

We can start by fixing all these annoying bugs related to the 
module/package system. For example:

* "private" is ignored for template functions
* Protection attribute on alias declarations don't seem to work
* "package" is quite broken by design
* If I recall correctly selected imports == public imports or something 
like that

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list