[Top][All Lists]

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

Re: [Help-smalltalk] Streams' copyFrom:to:

From: Paolo Bonzini
Subject: Re: [Help-smalltalk] Streams' copyFrom:to:
Date: Sun, 31 Dec 2006 16:51:10 +0100
User-agent: Thunderbird (Macintosh/20061207)

I'll assume that 0-index is intended, because that's what
PositionableStream>>#segmentFrom:to: depends on in compiler/

Yes, it's right.

On a related note, I found something else in kernel/

copyFrom: from to: to
    "Answer the contents of the file between the two given positions"
    | offset fromPos toPos savePos |
    from > to ifTrue: [
        from = to + 1 ifTrue: [ ^self species new ].
        ^SystemExceptions.ArgumentOutOfRange signalOn: from mustBeBetween: 1 
and: to + 1
    savePos := self fileOp: 5.
        self position: fromPos.
        self next: toPos - fromPos + 1
    ] ensure: [
        self position: savePos

How do offset, fromPos, and toPos get set in this method?

This is blatantly wrong... s/Pos//g and remove the three temporaries.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]