Spoon progress 27 July 2006: shared variables

Craig Latta craig at netjam.org
Sat Jul 29 08:29:15 UTC 2006

Hi Nicolas--

> How will we understand code when reading [the source for a method
> which uses a class whose name is used by multiple classes]? Hyperlink
> navigation?

	That's one possibility. I expect there will be some visual cue in the
rendering of the class name, so that the casual reader will know that
there are other classes that also have that name. If the reader wants to
know more about that class, the tools can provide more information
(probably via a menu or hyperlink navigation). Keep in mind that this
situation will probably be relatively rare in the first place.

> The only concern is if one ever wanted to rebuild a system from
> source... Being asked for many choices, it would be quite boring...
> And it would be very hard to investigate code from others...

	Indeed, I only intend this interactive mode of use to be used in the
situation of a human entering source manually. I think we can bootstrap
new systems without using source, by writing out object memories
directly (rather like the system tracer and the Fenix work).

> In case you want to merge two equivalent classes because they are
> doing mostly the same job, you'll have to recompile from source.

	I don't think that's true. You could just transfer all the compiled
methods into a common class programmatically. Any conflicts will
probably have to be resolved interactively anyway.

> I imagine you could maybe give a hint to the compiler so that it does
> not ask you twice the same question within the same compiling unit...

	Sure; I expect there will be several environment preferences related to
how chatty the compiler is during interactive development.

> If you want to use shared pool keys in your code, you have to declare
> it somewhere (in class definition by now). Do you write something like
> (poolDictionaries: {Text constants}) instead of (poolDictionaries:
> 'TextConstants')?

	Well, first of all there will be two pool-dictionary-related instance
variables in Class instead of one ("publishedPools" and "receivedPools").

> If that is the case, i see a little problem. If we store and
> initialize TextConstants in a Text classVariable, how would Text use
> CR constant itself? There is a bootstrap problem in class definition:
> ArrayedCollection
>    subclass: #Text
>    instanceVariableNames: 'string runs'
>    classVariableNames: 'TextConstants'
>    poolDictionaries: {Text constants}
>    category: 'Collections-Text'
> Should TextConstants be declared and initialized in a neutral place?

	I expect that a class' published pools (the pools for which it is
responsible, and which it provides to the rest of the system) will be
defined as part of class initialization. Thereafter, the pool objects
themselves are transferred directly. The way class objects are
transferred from one system to another in Spoon is much more
sophisticated than using an expression like the one you cite above.

	I also expect that the browsing tools will provide an actual user
interface for interactively defining new classes, rather than the crude
way we've been doing it all this time (editing an expression and
evaluating it).

	Finally, there won't be an inherent need to use class variables when
defining or initializing shared pools.

> Do per-method meta declarations like
> <thisCompiler useSharedPool: Text constants>

> make any sense?

	It's doable. But personally, I'd find it confusing for every method to
have its own compilation environment (potentially). I'd prefer to keep
this decision with each class.

> Sometimes we have to check for existence of a class. This can be done
> with (Smalltalk includesKey:  #MyClass). VW has #{MyClass}
> construct... What is your replacement? Root class tree recursion?

	Yes, searches from the root class.

> Of course, you cannot rely only on name anymore...

	Right, relying on the name alone was always risky! With the mechanisms
you mention above, you're still not really sure you're getting a
meaningful answer. What you really want to know is whether there is a
class which implements a particular set of messages with a particular
set of meanings (i.e., a particular interface).

	You might also want to ensure that this class has some expected
performance characteristics, or was written by a particular set of
authors, or was written at a particular point in time, etc. You can make
as detailed a query as you like in the scheme I propose.

> From what you explained, i do not see major weak point in your
> approach. It seems consistent and quite solid to me.

	Thanks for reading and for your comments!


Craig Latta

More information about the Spoon mailing list