[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: `file-attribute' accessors
From: |
Drew Adams |
Subject: |
RE: `file-attribute' accessors |
Date: |
Mon, 9 Apr 2012 10:08:27 -0700 |
> >> `(file-attribute-size (file-attributes file-name))', that
> >> would have
> > Please name it file-size and possibly file-mtime, file-ctime and
> > file-atime, which is what I have been doing in my .emacs.
>
> Such name would imply that the arg is a file(name) rather
> than a set of file-attributes.
Yes, and `file-attribute-size' gives the impression that it is about the size of
a file attribute. And so on.
I do not see this requested enhancement (adding 11 attribute accessor functions)
as worth it. It's misguided - just cruft.
For operations that are particularly useful we could instead add a function that
takes the file name as arg and returns a particular attribute value - e.g.
`file-size', `file-type', `file-uid'.
Other than such cases, YAGNI: If you want only one attribute value there is no
reason to clutter your code with (this-is-the-one (give-me-all-of-them FILE))
instead of just (give-me-the-one FILE).
And we probably do not need such a function for each attribute. E.g. attribute
#9: "t if file's gid would change if file were deleted and recreated". YAGNI.
If you prefer, you could append "-attribute" to the name: `file-size-attribute'
etc. instead of `file-size' etc.
But in any case these functions would be applied to a filename, the same way
`file-attributes' is, and not to the result of calling `file-attributes'.
(Accessor functions, indeed - bof.)
> > If this sounds OK, I can add the, erm, 11 trivial accessor
> > functions and adjust the documentation of `file-attributes'
> > in trunk.
>
> I guess that'd be OK.
Hasty and bad idea, IMHO.
(If you really want to look for enhancements, check the bug list - there are
lots of enhancement requests there that make more sense than this one. And
`report-emacs-bug' is the way to submit an enhancement request, in any case.)
- Re: `file-attribute' accessors, (continued)
- Re: `file-attribute' accessors, Lars Magne Ingebrigtsen, 2012/04/09
- Re: `file-attribute' accessors, Thierry Volpiatto, 2012/04/09
- Re: `file-attribute' accessors, Ted Zlatanov, 2012/04/09
- Re: `file-attribute' accessors, Lars Magne Ingebrigtsen, 2012/04/09
- Re: `file-attribute' accessors, Stefan Monnier, 2012/04/09
- Re: `file-attribute' accessors, Ted Zlatanov, 2012/04/09
- Re: `file-attribute' accessors, Stefan Monnier, 2012/04/09
- Re: `file-attribute' accessors, Miles Bader, 2012/04/10
Re: `file-attribute' accessors, Leo, 2012/04/09
Re: `file-attribute' accessors, Leo, 2012/04/09
Re: `file-attribute' accessors, Stefan Monnier, 2012/04/09