Re:Why I want Swift to be your first language
by Someone on Thursday August 27, 2015 @04:14PM
(#10131799)
I don't see him state that. His argument seems to boil down to:
1) I want to use a single teaching language.
2) We need to teach them about memory management.
3) C style manual memory management is too hard for beginners.
If you accept #1 and #2, you can't start with a language with the full 'magic' of garbage collection, as it would have to be the only language, and you cannot teach #2 with it.If, in addition, you accept #3, ARC makes sense to me. You can have your pupils implement quite a bit of advanced data structures such as trees and tries before you hit your first cycle, but there are 'real' data structures that use them, so you won't have to make up some artificial example to find one. Until that time, you can let your pupils think that the machine reuses memory as soon as it is no longer referenced.
I think his arguments make some sense, but I am not sure I'm fully behind #1.
Re:Why I want Swift to be your first language
by glhaynes on Thursday August 27, 2015 @04:09PM
(#10131764)
On the other hand, a student would likely be quite far along with an ARC language (well beyond intro) before they'd need to understand anything about the subtleties of it or even its existence. Until then, they can just treat it as though it were GC. One might even argue that if they're going to eventually learn manual memory management, ARC's subtleties might act as a good intermediate step. I think it's about a wash.
Re:Why I want Swift to be your first language
by AstralStorm on Saturday August 29, 2015 @11:03AM
(#10140196)
Well, look at it this way: Python used (still uses?) very standard reference counting. It can go very far into the design.
What he's wrong about is that the choice is C style, ARC or full GC. There's another intermediate step which is achieved by using C++11 smart pointers - manual reference counted memory management.
I'm the least fan of GC as anyone else but needing to have intro students worry about cycles seems like the last thing you want to teach first.