develooper Front page | perl.perl6.language | Postings from July 2005

File.seek() interface

Thread Next
From:
wolverian
Date:
July 7, 2005 10:18
Subject:
File.seek() interface
Message ID:
20050707171840.GA4320@noesis.saunalahti.fi
Hello,

gaal is porting the Perl 5 filehandle functions to a Perl 6 OO
interface. The Perl 5 interface with global constants from Fcntl strikes
me as severely lacking in elegance and OO.

    $fh.seek(-10, SEEK_END);

Instead of globals, how about a :from adverb?

    $fh.seek(-10, :from<end>);

Or maybe we don't need such an adverb at all, and instead use

    $fh.seek($fh.end - 10);

I'm a pretty high level guy, so I don't know about the performance
implications of that. Maybe we want to keep seek() low level, anyway.

Subject to change when it comes to the Perl 6 Unicode semantics, of
course. :)

Any thoughts/decisions?

-- 
wolverian

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About