lua-users home
lua-l archive

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


On 09/18/2017 07:18 PM, tobias@justdreams.de wrote:
> s1 = Segment( 128, 256 ) -- Segment with 128 byte offset and 256 bytes length
> s2 = Segment( 439 )      -- this is the question, shall this be:
> 
>                      - a segment starting at byte 439 and have a length to the
> end of the buffer, or
>                      - a segment starting at first byte being 439 bytes long
> 
> I don't think there is a 'right' answer, but to all those people who work with
> this kind of stuff, what would feel more natural to you?
> Also, does Segment( offset, length ) makes more sense than Segment( length,
> offset ) ?
> 
> Thanks for the input,
> 
>  - Tobias

I feel (<offset>, <length>) order is more natural for describing segments.

But for slightly different task, say function to read <length> bytes from
current or specified stream position, (<length>, <offset>) order is natural.

-- Martin