[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: [ANN] win32-file 0.1.0

Christoph R.

10/30/2003 6:00:00 PM

Berger, Daniel wrote:
...
> #
> # > > Synopsis
> # > > ========
> # > > require "win32/file"
> # > >
> # > > some_file = "C:\\Documents and
> # > Settings\\some_user\\fruitylicious.txt"
> # > >
> # > > Win32::File.attributes(some_file) # e.g.
> ['hidden','archive'] # > # > Why not use symbols instead?
> #
> # Dunno - didn't think it really mattered. Does it?
> #
>
> Personally, I generally dislike the symbol-as-hash key
> style--even if there is some kind of performance gain to be
> had from it. So, you've got my vote to keep it as it is. :)

Just throwing in a curve ball on this frivolous matter, but
I strongly prefer the symbol style over strings. In fact, it
always bucket me that the reflection methods like
Module#instance_methods or Object#instance_variables
return arrays of strings instead of symbols.

Ps. Thank you very much for all win32 extension -
they are really fantastic! Also what kind of nfts (5+)
features will your win32/file extension support?


/Christoph



2 Answers

Sean O'Dell

10/30/2003 7:12:00 PM

0

On Thursday 30 October 2003 09:59 am, Christoph wrote:
> Berger, Daniel wrote:
> ...
>
> > #
> > # > > Synopsis
> > # > > ========
> > # > > require "win32/file"
> > # > >
> > # > > some_file = "C:\\Documents and
> > # > Settings\\some_user\\fruitylicious.txt"
> > # > >
> > # > > Win32::File.attributes(some_file) # e.g.
> > ['hidden','archive'] # > # > Why not use symbols instead?
> > #
> > # Dunno - didn't think it really mattered. Does it?
> > #
> >
> > Personally, I generally dislike the symbol-as-hash key
> > style--even if there is some kind of performance gain to be
> > had from it. So, you've got my vote to keep it as it is. :)
>
> Just throwing in a curve ball on this frivolous matter, but
> I strongly prefer the symbol style over strings. In fact, it
> always bucket me that the reflection methods like
> Module#instance_methods or Object#instance_variables
> return arrays of strings instead of symbols.
>
> Ps. Thank you very much for all win32 extension -
> they are really fantastic! Also what kind of nfts (5+)
> features will your win32/file extension support?

Actually, shouldn't these be constants of the File class?

Something like this maybe:

Win32::File.attributes(some_file) -> {File::HIDDEN => true, File::ARCHIVE =>
true}

Sean O'Dell


Berger, Daniel

10/30/2003 8:04:00 PM

0

Sean O'Dell wrote:
>
> On Thursday 30 October 2003 09:59 am, Christoph wrote:
> > Berger, Daniel wrote:
> > ...
> >
> > > #
> > > # > > Synopsis
> > > # > > ========
> > > # > > require "win32/file"
> > > # > >
> > > # > > some_file = "C:\\Documents and
> > > # > Settings\\some_user\\fruitylicious.txt"
> > > # > >
> > > # > > Win32::File.attributes(some_file) # e.g.
> > > ['hidden','archive'] # > # > Why not use symbols instead?
> > > #
> > > # Dunno - didn't think it really mattered. Does it?
> > > #
> > >
> > > Personally, I generally dislike the symbol-as-hash key
> > > style--even if there is some kind of performance gain to be
> > > had from it. So, you've got my vote to keep it as it is. :)
> >
> > Just throwing in a curve ball on this frivolous matter, but
> > I strongly prefer the symbol style over strings. In fact, it
> > always bucket me that the reflection methods like
> > Module#instance_methods or Object#instance_variables
> > return arrays of strings instead of symbols.
> >
> > Ps. Thank you very much for all win32 extension -
> > they are really fantastic! Also what kind of nfts (5+)
> > features will your win32/file extension support?
>
> Actually, shouldn't these be constants of the File class?
>
> Something like this maybe:
>
> Win32::File.attributes(some_file) -> {File::HIDDEN => true, File::ARCHIVE =>
> true}
>
> Sean O'Dell

For this particular method I don't think it's necessary. It's certainly
less painful to return and/or parse an array of strings vs. a hash of
hashes that contains constants. However, I may add it in the future for
'set' methods. Perhaps something like:

# File.chattr(file,AttributeConstant) - Set file win32 attribute

File.chattr("some_file",File::HIDDEN)

I'll think about it. I should also mention that I wouldn't expect this
to be a highly used method, so maybe that's why I'm somewhat indifferent
on the subject. In any case, adding the security stuff has higher
priority at the moment (to answer Christoph's earlier question). Thanks
for the feedback!

Regards,

Dan