emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `file-attribute' accessors


From: Lars Magne Ingebrigtsen
Subject: Re: `file-attribute' accessors
Date: Mon, 09 Apr 2012 18:29:06 +0200
User-agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.0.94 (gnu/linux)

Ted Zlatanov <address@hidden> writes:

> I would extend `file-attributes' to take &rest symbols after the extra
> format argument, so you could say
>
> (file-attributes FILE nil 'size 'mtime)

Yeah, that makes sense.  I kinda like accessor functions, though, since
they make it natural to say stuff like

(reduce '+ (mapcar 'file-attribute-size (mapcar 'file-attributes 
(directory-files dir))))

but the &rest makes a lot of sense.

While we're bikeshedding, using a plist (as previously suggested) would
also be nice when we're returning lists.  So

(file-attributes FILE nil 'size 'mtime)

could return `(size 3422 mtime (232 42))', perhaps?  Anyway, I think the
optional ID-FORMAT parameter is awkward, and doesn't really belong in
such a low-level access function, in my opinion.  But getting rid of it
is out of the question, I guess?  Although the doc string says

---
ID-FORMAT specifies the preferred format of attributes uid and gid (see
below) - valid values are 'string and 'integer.  The latter is the
default, but we plan to change that, so you should specify a non-nil value
for ID-FORMAT if you use the returned uid or gid.
---

which is going to break stuff, anyway.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]