digitalmars.D - Stricter protection attributes for students
- bearophile (6/6) May 31 2010 D2 is quite complex, so it's not the best language to teach programming,...
- Jesse Phillips (6/14) May 31 2010 I do not think this is a reason to change tho module/protection system i...
- Jacob Carlborg (10/16) Jun 01 2010 We can start by fixing all these annoying bugs related to the
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). 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
May 31 2010
On Mon, 31 May 2010 21:47:18 -0400, 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.I do not think this is a reason to change tho module/protection system in D. It is true that students are taught protection in the strictest sense, but that doesn't make it the right choice. And I believe you have already tried to cover why it is correct in other posts. Fixing bugs in the system goes without saying though.
May 31 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). 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, bearophileWe 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
Jun 01 2010