I’ve noticed that as we’ve progressed there has been a move to more concise and
fluid code - e.g. I quite like the new String streaming stuff
e.g.
^ String
streamContents: [ :stream |
stream nextPut: …. ]
So I was wondering why we don’t have a construct like Pascals with to avoid
Book1.title, Book1.author etc.
(* book 1 specification *)
With Book1 do
begin
title := 'C Programming';
author := 'Nuha Ali ';
subject := 'C Programming Tutorial';
book_id := 6495407;
end;
I often find it a bit tedious with code like the following which then needs an
instvar...
self classes do: [ :class |
| metaclass |
metaclass := class metaclass.
metaclass xxxx.
mataclass yyyy.
]
I’m wondering why we don’t have #with:do:
class with: class metaclass do: [:metaclass |
metaclass xxx.
]
But when such things aren’t there - there is usually a good reason and I’m
curious … this said, there are all kinds of other such tricks (which I rarely
use that I keep coming across).
Tim