[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: inner methods
> From firstname.lastname@example.org Sun Oct 27 14:10:36 1991
> Return-Path: <email@example.com>
> Date: Sat, 26 Oct 91 14:28:33 EDT
> To: firstname.lastname@example.org
> Subject: inner methods
> Content-Length: 545
> X-Lines: 18
> I can't see what is the purpose of inner methods. For example, in :
> _AddSlotsIfAbsent: ( | imTests = () | ).
> imTests _Define: ( |
> test1: a And: b = ( a * b * b ).
> test2: a And: b = ( ( a * b ) * b ).
> | ).
> Both test1 and test2 do exactly the same thing, but test2's structure
> at the bytecode level is more complex. If fact, for inner methods with
> no local slots, I believe you can always "inline" the inner method's
> Since inner methods with local slots are rare ( I think ), do we
> really need them ?
> - Jecel
Well, yes and no.
It's nice to know that you can walk up to any method, see:
. . . <some-message> ...
and replace it with
... (|t| doAnythingFirst. t: <some-message>. doAnythingAfter: t. t) ...
This might be nice for debugging, for example.
Also, inner methods make the language more elegant (to our eyes).
Of course, they do waste space.
And many languages (C, PASCAL, FORTRAN, COBOL) get along fine without them.