I worked through it for a class, and I distinctly remember a moment where I thought "what the fuck - did I just write a working type inferencer?". It has a great way of simplifying things to the point where adding a complex new language feature isn't a distant theoretical proposition, it seems like a simple and straightforward next step. Of course, it helped that I had a great instructor.
I can't speak for this new book, but it seems like an interesting combo of intro to programming and programming languages. And it's in pyret, which is like the bastard child of python and plt-scheme: http://www.pyret.org/
EDIT: just skimmed through the text, you seem to be using "type-like annotations" mentioned in Pyret docs.
Another thing to note - Pyret is much more readable/enjoyable (and I guess writable :)) than the previous lisp languages you've used. Thanks!
I don't know why you say types are an afterthought. HtDP teaches a profoundly _typed_ discipline of programming. The datatype mechanism in PLAI continues this with more enforcement. And plai-typed is anything _but_ an "afterthought", right?
PAPL is written as if types work. We have an internal type-checker that I've been using off-and-on this semester (but it's still in development). As soon as it's ready, all programs in the book will pass through it and the book will be almost completely typed.
I'm not going to get into an argument here about whether it is better to start with static types. Though I somewhat share @noelwelsh's viewpoint, I think the full situation is far more complex and demands actual research — HCI research — as opposed to just matters of opinion (including mine).
No, no, plai-typed is great. I meant that PLAI book initially used a dynamically typed language (and I guess it is preserved in the printed edition), but you switched to plai-typed afterwards, and I believe you'll switch to full static typed Pyret for this book as well, when it becomes ready :)
("shameless plug": Actually, it was me who notified you about the plai-typed effort and you further developed it, during your online PLAI class at Brown ;))
Agree about a typed discipline, but I meant specifically static typing for the implementation (host) language.
As for preferences, yes, actually Noel has a point - learning debugging type errors in a dynamic languages is a skill useful in a "real world" (unfortunately :))
I'm sure Shriram will correct me if I'm wrong.
I keep hearing your name, first because Kathi was my beloved teacher and advisor, second because Justin worked with you, and third because I made Frank Goodman take your class. Maybe we'll finally meet one day!
We will often build up programs incrementally, just as a pair of programmers
would. We will include mistakes, not because I don’t know the answer, but
because *this is the best way for you to learn*. Including mistakes makes it
impossible for you to read passively: you must instead engage with the
material, because you can never be sure of the veracity of what you’re
I’d also agree with the author that a good book for readers to learn from does not make a good reference book (and vice-versa).
It seems to me that FP is having quite a renaissance recently, which could limit the relevance of that paper's contentions today. I'm also seeing quite a backlash against OOP and especially OOP as the One True Paradigm that it was pushed as in throughout the 00s - this can be seen not only in FP language growth but also in the design of other new languages like Go that lack many OOP features.
Honestly, I would argue for the "Never Compromise" route for undergraduate regardless of current trends. I've found firsthand that mid-to-high-achieving high school students are able to grep SICP just fine, even if they haven't been introduced to calculus as of yet. But I haven't read HtDP or PPL yet, so I can't really pass judgement on which book would be better.
It seems that FP is always having a renaissance. I distinctly recall lots of people (including me) talking in 2001-2002 about the big FP renaissance just round corner. I also recall a few old school lisper rolling their eyes at us and saying that they where saying the same thing back in the early-mid 80's.
Old Lispers' eyes are stuck in a permanent roll position, like the Agena-Gemini 8 dock.
It seemed that the money was heavily pushing Java and that most curriculum immediately jumped to where they thought future money was. Sometimes they would back off and try to get back to a more theoretical or instruction based methodology, but would always hedge with a language that was seen as friendly to industry.
Curious if there are any expansions on why it was dropped.
I was recently re-reading SICP, and was amazed by how cleverly structured it is. It somehow goes for an entire fifth of a book without any data structure at all. It retrospect, I consider it something of a virtuoso achievement to have pulled that off while writing a book that is utterly compelling on every page. However, the only way it can achieve that is by focusing _entirely_ on what we call "domain knowledge". As the kind of person who has always loved the play of numbers, I was immersed fully and barely noticed what was happening when I read it as a student. To most students, however, this material is both uninteresting and difficult, and difficult material that isn't even relevant to the domain is especially uncompellling.
Of course, diving into data early means you need a lot more help structuring your programs. HtDP focuses precisely on that problem, _using_ the data to drive the structure (inspired by earlier efforts such as The Little Lisper). And this highlights exactly how very different the two books are. It is much like the comment about the US and UK: "two countries separated by a common language". The coincidence of using (almost) the same language in both books has, sadly, created a great deal of confusion on this point.
> It somehow goes for an entire fifth of a book without any data structure at all
Funny, in the MOOC I linked, from what I remember, they spent a lot of time writing programs without compound data types too. Only by having naive conventions (item0, item1,...) to let us recognize the logic behind complex type in the problem data and let it sink in our minds. I don't know how close to the book this was though so I don't wanna give off conclusions.
Absolutely. (Though that wording suggests a stronger causal link than was really present. It was written to address a need, a need that happened to not be addressed by SICP.)
Errr, not really, both are CS professors, although Sussman is very interested in EE and teaching it.
Rather, it was written for MIT students, who arrive at a bare minimum ready to learn the calculus, and taking the SICP course 6.001 was strongly discouraged during your first term (it's a lot of work, even for students who know programming and Lisp).
And the core curriculum 6.001-4 that all EECS students had to take back then included two math not optional EE courses. MIT's vision of what a CS student should know includes a lot of EE, which is common in department that started from EE (e.g. UC Berkeley), and less so in ones that didn't, e.g. that started from Math.
That said, most any MIT student could take 6.001 and benefit, the use of math is simply based on the fact that it was a common body of stuff all the students taking 6.001 would know.
At any rate, I'm committed to having a full copy of the book available for free to all, as is also true of HtDP (we were one of the pioneers in this space) and PLAI (which has even more free/commercial options than HtDP).
You may assume at least a CC BY-NC-ND, which lets typical users have at it right away.
If it has no DRM but is 'all rights reserved', and I really want a copy, I wait for a chance to buy it at a deep discount.
If it is released under a CC 'non-commercial' license, I buy a copy at full price.
If it is released under a CC license which allows commercial use, I pay extra for a copy (at sites like www.leanpub.com) or buy 2 copies.
At any rate, I would gladly pay for a copy (or two) of PAPL if the option were available and a CC license declared.
BTW, thanks for this resource!
"The simplest notion of an object—pretty much the only thing everyone who talks about objects agrees about—is that an object is:
a value, that
maps names to
stuff: either other values or “methods”."
(I don't want to start a debate or anything, just thought it was a practical, minimal definition)
Notable for the "behaviour and state":
3. Objects have their own memory (in terms of objects).
4. Every object is an instance of a class (which must be an object).
5. The class holds the shared behavior for its instances (in the form of objects in a program list)
And more importantly, as a first sentence to explain what an object is, it's misleading and will raise a lot more questions later.
My problem is that it's not presented as a starting point or even implied that the definition might be wrong. It categorically states "The simplest notion of an object—pretty much the only thing everyone who talks about objects agrees about— is". If it had said "One notion of an object -one that many people who talk about objects agree on- is", all would be dandy. When you're stating things as fact in a document dedicated to learning, they should be solid.
My other gripe is that I've heard too many vague, biased or incomplete answers to the question "what is an object". These are structures people use every second of every day, but they've never learned a proper definition for it?
Well, "behaviour and state" is also incomplete, because it fails to mention anything about how you refer to parts of state and particular behaviours.
"a mapping of names to values and functions" on the other hand mentions both state ("values") and behaviour (functions) and also tells you that they have names.
> they've never learned a proper definition for it?
Well, there are many different valid definitions for objects, and even more for OO. There are people who don't know any of them for sure, but I strongly suspect that you've dismissed many good definitions as "vague, biased, incomplete" on the grounds of them not being your preferred one. You did it at least once just now, when you failed to realize that "a mapping of names to values and functions" is the same thing as "[named] behaviour and state".
It's possible that my dismissal of many definitions is partly because they're not my preferred one. I'm human, so it's most likely the case. I like to think my preferred one at least came about through some investigation, and it's the only one that I've seen fit a wide enough variety of cases. For me, at least part of the validation comes from the fact that I was frustrated at the definitions people gave me long before I found one I liked. Too many conversations with college teachers, mentors and colleagues that went
"So how would you define/describe an object?"
"OK, but what about [language/edge case/model]?"
I don't find your definition particularly useful, either: it's too encompassing to really be of much use _to me_. By this definition just about all computation is an "object", which doesn't really tell me anything interesting.
Also, as a general pedagogic principle, I'm opposed to definitions that are too vague to say much to a middle-of-the-pack undergraduate. I'd definitely put your definition of objects in that space. It sounds like good stuff—it's certainly "quotable"—but the typical student would be hard-pressed to actually explain it or put it to use.
The usefulness is debatable. To me, it's been useful because it helped me see that, for example, a process can also be an object, and you can apply object oriented rules to interacting processes. The Actor model is an extension of that. Modelling a set of Microservices as an object model has also proven valuable.
How you communicate it to students is a not an easy matter. I'm opposed to giving definitions as an absolute truth if they aren't, even if you're doing to prove a point. If you want to teach with different definitions, that is of course perfectly fine, but at least a mention of the debate could solve some later problems. People tend to adhere to the 'laws' they learn for a long time, and if you teach them a definition that is incorrect in some cases, they'll have trouble with those cases.
Ok, after that explanation I understand what you mean. I could argue that, for example, object construction and destruction semantics are not characteristics of an object itself but rather of a particular object system or "meta-object protocol" being used; or that it's almost impossible to talk about object destruction outside of particular language context, because it relies on many different language-level features to work. But that would be too much of a hair-splitting for me :)
On the other hand I could argue that a set of functions is enough to express every possible type of behaviour and that a set of values is enough to express any possible state. But this in turn depends on the definitions of "value" and "function", which are highly language specific.
So, after thinking about it for some time, I think I can agree that "behaviour and state" is the best (possible?) definition of those which avoid diving into any implementation details and language specific features.
I'm not entirely convinced that such a definition is very practical though. You probably won't need that level of generality until you decide to implement your own object system. It won't help you (I think?) in OO design or OOP inside of some particular object system.
But anyway, you're right in that your definition is the best one in the category of "general" and "minimal" definitions of what objects are.
Sorry for ad personam in my previous comment and thanks for the discussion, it was enjoyable :)
No apologies necessary, it was absolutely fair to call me out on a bias on my end. You too thanks for the discussion :)
> If you ask Pyret for the value of this program, it will unsurprisingly tell you that it’s 3.
I am not sure how to do that. In [this tutorial](http://www.pyret.org/docs/latest/A_Tour_of_Pyret.html#%28par...) everything is a test. Is the program 3 supposed to be run as a test as well? Just running 3 in the editor does nothing. Where can I read up on Pyret syntax so i can follow this book?
> 1 + 2
Thanks in advance. :-)