Re: backtick units (Was: File.seek() interface)

2005-07-09 Thread James Mastros
Wolverian wrote: > On Thu, Jul 07, 2005 at 05:58:53PM -0700, Larry Wall wrote: >>$fh.pos = $fh.pos + 10`lines > > I'm sorry if this has been discussed, but is the ` going to be in > Perl 6? I like it. :) I was hoping it was going to be in the standard library, but non-core. Using it for manip

Re: File.seek() interface

2005-07-07 Thread Larry Wall
On Thu, Jul 07, 2005 at 06:15:03PM -0700, Paul Hodges wrote: : : : --- Larry Wall <[EMAIL PROTECTED]> wrote: : > Arguably, we could probably admit : > : > $fh.pos = 10`bytes : > : > for the case of seeking from the begining. But I'd kind of like : > : > $fh.pos = 10 : > : > to be con

Re: File.seek() interface

2005-07-07 Thread wolverian
On Thu, Jul 07, 2005 at 05:58:53PM -0700, Larry Wall wrote: > $fh.pos = $fh.pos + 10`lines I'm sorry if this has been discussed, but is the ` going to be in Perl 6? I like it. :) How does it work, though? sub *infix:<`> (Num $amount, Unit $class) { $class.new($amount) } Or so? Now I'm t

Re: File.seek() interface

2005-07-07 Thread Paul Hodges
--- Larry Wall <[EMAIL PROTECTED]> wrote: > Arguably, we could probably admit > > $fh.pos = 10`bytes > > for the case of seeking from the begining. But I'd kind of like > > $fh.pos = 10 > > to be considered an error. It seems a logical extension also to say $fh.pos += 10`byte

Re: File.seek() interface

2005-07-07 Thread Larry Wall
On Thu, Jul 07, 2005 at 02:15:19PM -0600, Paul Seamons wrote: : > We should approach this from the perspective that $fh is an iterator, so : > the general problem is "how do we navigate a random-access iterator?". : : Well - I kind of thought that $fh was a filehandle that knew how to behave :

Re: File.seek() interface

2005-07-07 Thread Luke Palmer
On 7/7/05, wolverian <[EMAIL PROTECTED]> wrote: > On Thu, Jul 07, 2005 at 08:18:40PM +0300, wolverian wrote: > > 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. > > Sorry about replying to myself, but I wa

Re: File.seek() interface

2005-07-07 Thread wolverian
On Thu, Jul 07, 2005 at 08:18:40PM +0300, wolverian wrote: > 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. Sorry about replying to myself, but I want to ask a further question on this. Would it be possibl

Re: File.seek() interface

2005-07-07 Thread Paul Seamons
> We should approach this from the perspective that $fh is an iterator, so > the general problem is "how do we navigate a random-access iterator?". Well - I kind of thought that $fh was a filehandle that knew how to behave like an iterator if asked to do so. There are too many applications tha

Re: File.seek() interface

2005-07-07 Thread Dave Whipp
Wolverian wrote: 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. Any thoughts/decisions? We should approach thi

File.seek() interface

2005-07-07 Thread wolverian
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); Or mayb