Re: File test ops as string methods

2008-11-08 Thread Xiao Yafeng

 I've been thinking about that.  One interesting ramification of
 the current matching rule is that you could say either of:

foo.io ~~ :r :x

 or

foo ~~ :io(:r :x)

 where .io is whatever your casting method of choice is for turning
 a string into an object with the correct methods.  Somehow I think
 .filename is a bit too long, huffmanwise.


If io is casting method, which statement below is correct:

say ok if 1234.io  1000;

or

say ok if 1234.int 1000;


File test ops as string methods

2008-11-07 Thread Mark J. Reed
I'm sure this has been hashed out somewhere I wasn't looking, but i
would really prefer for pathname ops not to be mixed in to the Str
class.  Maybe they could be put in a Pathname subclass of Str, with a
simple literal syntax or short unary operator to build such a thing
from a string?


-- 
Sent from Gmail for mobile | mobile.google.com

Mark J. Reed [EMAIL PROTECTED]


Re: File test ops as string methods

2008-11-07 Thread Brandon S. Allbery KF8NH

On 2008 Nov 7, at 17:49, Mark J. Reed wrote:

I'm sure this has been hashed out somewhere I wasn't looking, but i
would really prefer for pathname ops not to be mixed in to the Str
class.  Maybe they could be put in a Pathname subclass of Str, with a
simple literal syntax or short unary operator to build such a thing
from a string?



I'm inclined to agree that Str is the wrong place for them.  I could  
see Str being autoconverted to some kind of File class which had them,  
though.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon universityKF8NH




Re: File test ops as string methods

2008-11-07 Thread Larry Wall
On Fri, Nov 07, 2008 at 05:49:54PM -0500, Mark J. Reed wrote:
: I'm sure this has been hashed out somewhere I wasn't looking, but i
: would really prefer for pathname ops not to be mixed in to the Str
: class.  Maybe they could be put in a Pathname subclass of Str, with a
: simple literal syntax or short unary operator to build such a thing
: from a string?

I've been thinking about that.  One interesting ramification of
the current matching rule is that you could say either of:

foo.io ~~ :r :x

or

foo ~~ :io(:r :x)

where .io is whatever your casting method of choice is for turning
a string into an object with the correct methods.  Somehow I think
.filename is a bit too long, huffmanwise.

Larry