RE: reply for your message

From: "Rich Kilmer" <rich@...>
Date: 2002-08-07 12:40:54 UTC
List: ruby-core #307

> -----Original Message-----
> From: Yukihiro Matsumoto [mailto:matz@ruby-lang.org]
> Sent: Saturday, August 03, 2002 7:45 PM
> To: ruby-core@ruby-lang.org
> Subject: reply for your message
> 
> Hi,
> 
> In message "your message"
>     on 02/08/03, Florian Frank <flori@nixe.ping.de> writes:
> 
> |some methods of File::Stat return 0 if the underlying feature isn't
> |supported on the target platform. Wouldn't it be nice if they
returned
> |nil? With nil it would be possible to use the idiomatic
> |	size = stat.blksize || 4096
> |to give a default value without first checking if blksize is 0.
> 
> Hmm,
> 
> 	size = stat.blksize.nonzero? || 4096
> 
> works well without any modify.  I'd like to hear from others,
> especially those who working on the platforms without these members in
> struct stat.
> 

I would find this very useful.  I often write scripts that need to 
execute on Linux and Win32, and its this exact type of inconsistency 
that can be hard keep track of.

-Rich

In This Thread

Prev Next