Can't load iterator.slate

Brian Rice water at tunes.org
Thu Nov 4 18:45:09 PST 2004


On Nov 4, 2004, at 6:28 PM, Pupeno wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> When trying to load iterator.slate using the lattest CVS HEAD, I get 
> the
> following error:
> I'm trying to load this since I thought it provided the method 
> contents I need
> for the lattests src/ui/region.slate:

This is the wrong path to take. src/lib/iterator.slate is in the 
standard library, and the streams it defines are used everywhere, so 
until we have safe code-reloading, do not expect such libraries to 
re-load safely. Even so, this is not the logical thing to do when 
having a problem in the UI code or anywhere else.

> Slate 1> load: 'src/ui/init.slate'.
> Loading 'src/ui/init.slate'
> Loading 'src/ui/color.slate'
> Loading 'src/ui/event.slate'
> Loading 'src/ui/region.slate'
> The following condition was signaled:
> The method #contents was not found for the following arguments:
> {(globals. Graphics. Types. traits. Mixins. VM. prototypes)}
>
> I've tried inspecting the stack frame, but I couldn't understand it. 
> It seems
> that there's a method or something that should be reimplemented but 
> it's not
> being done, but I couldn't locate what.
> Maybe I am mistaken, can anybody enlight me ?

You are mistaken. When you get such an error, or any error, inspect 
stack frames. Look at the arguments presented, and ignore the 
administrative continuation data underneath.

If you see an error-raising selector and don't understand it, don't 
reload it, just go to where it's defined and read it. If you see an 
error /message text/ that you don't understand, dig down into the stack 
one or two levels to see the method call that raised it, and read the 
condition definition.

It turned out that #contents was called in a cascade block in a 
slightly-wrong manner, which may be a bug in cascading; I'll have to 
think it over. What you would see is an implicit context call just 
before the "you must override this method" condition.

> PS: Should I do my SDL development on 0.3.1 instead of CVS HEAD ?

This error turned out to be introduced by me while writing some 
comments and cleaning up code while conversing with you. I think if you 
learn how to deal with the debugger, you'll be fine, but otherwise 
should compare any results you get with a clean 0.3.1 tree before 
trying to reload libraries and other random solutions.

Here's the method in question from region.slate. It's the only call to 
#contents in the UI library with an implicit argument:

p@(PointND traits) origin
"Return the absolute idea of a 0-filled point for my size."
[p clone `>> [contents infect: [| :_ | 0]. ]].

This bug is fixed, as well. I transformed the code into a 
straightforward method without cascades:

p@(PointND traits) origin
"Return the absolute idea of a 0-filled point for my size."
[| result |
   result: p clone.
   result contents infect: [| :_ | 0].
   result
].

Bonus points (I guess that means a free feature request granted) if 
someone remembers what infect: does. ;-)

--
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/




More information about the Slate mailing list