Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 14 #11

Open
Ducasse opened this issue Sep 14, 2022 · 0 comments
Open

Chapter 14 #11

Ducasse opened this issue Sep 14, 2022 · 0 comments

Comments

@Ducasse
Copy link
Member

Ducasse commented Sep 14, 2022

Many exapmles of code do not declare any local variables but use them. This contrasts with the previous chapters, where each used local variable were declared in | |.

p. 190 Figure 14-2: Linked Implementation / SkipList - such class not exist in Pharo now. Should be removed. Then look: Linked Implementation - only LinkedList; Interval Implementation - only Interval; all other classes use Arrayed Implementation directly or internally. So, is the Figure really usefull?

p. 194

Error: "new: anInteger creates a collection of size anInteger whose elements will all be nil." is true ONLY for arrays: common Array and specialized variants. String new: 3 >>> ' ' - not three nil. I think "new: aSize" do not belongs to the COMMON creation protocol.
Question: How about new? Set new, Dictionary new, OrderedCollection new - the usual way to create an empty collection. Why there are not any mension about "new" in the subsection Common creation protocol?
Error: "(1 to: 5) asOrderedCollection addAll: '678'; yourself" will return "an OrderedCollection(1 2 3 4 5 $6 $7 $8)" not the "an OrderedCollection(1 2 3 4 5 6 7 8)". It should be "(1 to: 5) asOrderedCollection addAll: #(6 7 8); yourself"
Question: is it really appropriate to show addAll: in the Common creation protocol subsection?
p. 197 Error: The paragraph "Be careful: general principle is that literal arrays are not be modified! Literal arrays are kept in compiled method literal frames (a space where literals ap�pearing in a method are stored), therefore unless you copy the array, the second time you execute the code your literal array may not have the value you expect. In the example, without copying the array, the second time around, the literal #(1 2 3 4 5 6) will actually be #(1 2 33 4 5 6)! Dynamic arrays do not have this problem because they are not stored in literal frames." is partially wrong. A literal array is immutable now.

p. 200 Error: "(1 to: 6) union: (4 to: 10) >>> a Set(1 2 3 4 5 6 7 8 9 10)" - the wrong answer, Collection>>union: uses self species, and Interval>>species returns Array, so such answer is impossible. Should be ">>> #(8 5 2 10 7 4 1 9 6 3)"

p. 203 Error: "the method copyReplaceAll:" should be "the method copyReplaceAll:with:"

p. 209

Contradiction: "The message detect:ifNone: is a variant of the METHOD detect:." Should be "The message detect:ifNone: is a variant of the message detect:." Or "method -- method".
Mathematical error: "we could write this expression to sum the first 100 integers: (1 to: 100)..." 1 is not "a first integer" but it is a first Natural number. So, it should be "the first 100 natural numbers:"
p. 210 "Smalltalk mistakes" or "Pharo mistakes"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant