Well... you have the cascading that provides you that.

book1
   title:'C Programming';
   author: 'Nuha Ali ';
   subject: 'C Programming Tutorial';
   book_id: 6495407.

What I would like, sometimes, is the option to nest cascades, very
much like the WITH DO construct of Pascal, Basic and others.

But also I take this as a hint of some refactoring needed in my objects.

Regards,

Esteban A. Maringolo

El lun., 4 mar. 2019 a las 10:07, Tim Mackinnon (<tim@testit.works>) escribió:
>
> 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
>

Reply via email to