[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]

Re: [zzdev] Proper abstractions

Tuomas Lukka wrote:
> There are pros and cons. The reason for coding it the way I did was that I
> want to get both the cell and the distance as parameters. The same class
> can be used for other kinds of iteration too.

But my concept would support that: you can get the cell, the distance,
and other information (in the case of the alternator, the steps on the
dimension, i.e. negative for the negward cells) from the enum object.
And I thought about a common base class (ZZIter? :}), defining start(c),
more(), next(), distance(), and stoppart(); then, the same code could be
used with instances of different subclasses of ZZIter, which would have
the same effect as what you proposed (I think).
> I like the paradigm of callbacks - possibly I'm just showing my Perl
> background where something like that would have been especially easy, with
> anonymous subroutines. For some reason I've never liked the idea of
> enumerations. I don't know why.

In our case I feel it makes the code easier. If we where talking about a
language where anonymous subroutines are trivial, I might agree with you.

> Abstracting the dimension recursion is interesting but the question is how
> much more complicated would it be. Keeping track of how you're placing
> them in the grid seems difficult.

Right -- that's something to think about. But if we could find a way, I
would e.g. give my earlier LevelRaster attempt some new thought...
because it would be so much easier to do.