TxSpan>>#isAtEnd

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

TxSpan>>#isAtEnd

Sean P. DeNigris
Administrator
Right now, there is:
TxBasicSpan>>#isAtEnd ^ false
and
TxEndSpan>>#isAtEnd ^ true

However, there are cases were a list of spans has no end marker e.g. the argument to #insert:

I'm thinking of changing to: TxBasicSpan>>#isAtEnd ^ self next == self.
This will allow changing e.g. the following slightly opaque loop condition:
    [ span next == span ] whileFalse: [ span := span next ].
to:
    [ span isAtEnd ] whileFalse: [ span := span next ].

All tests pass with this change, but I'm still very much beginning learning Tx, so I wanted to run it by everyone to see if I'm missing something...
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: TxSpan>>#isAtEnd

Stephan Eggermont-3
On 04/05/15 05:43, Sean P. DeNigris wrote:

> All tests pass with this change, but I'm still very much beginning learning
> Tx, so I wanted to run it by everyone to see if I'm missing something...

What would need to change with a circular list?

Stephan



Reply | Threaded
Open this post in threaded view
|

Re: TxSpan>>#isAtEnd

Sean P. DeNigris
Administrator
Stephan Eggermont wrote
What would need to change with a circular list?
Right now, TxModel rolls-its own list implementation. I think the safest way would be to delegate to a real list object (I've been thinking it's probably a good idea anyway from a design perspective). Then we could plug in a different implementations and see.
Cheers,
Sean