Stricter protection attributes for students

bearophile bearophileHUGS at lycos.com
Mon May 31 18:47:18 PDT 2010


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


More information about the Digitalmars-d mailing list