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

get,getf



While looking through some of the system code that performs backups, I
came across the following:

	(dolist (elt (backup-dump-get-dir-list wildpath))
    (if (dumper-prefilter elt)
	(if (get elt :directory)
	    (push (car elt) dirs)
	    (push elt files))))

According to CLtL p. 164, and the Symbolics debugger, this shouldn't
work. GET is defined as returning a value from the property list of a
symbol and sure enough, if I try to run this as a function unto itself,
it blows up because elt is bound to an element of a list. Not to mention
that the value of elt is such that it won't work as a plist. It seems
like it should be written:

	(dolist (elt (backup-dump-get-dir-list wildpath))
    (if (dumper-prefilter elt)
	(if (getf (cdr elt) :directory)
	    (push (car elt) dirs)
	    (push elt files))))

My question is, why does the previous work? It obviously does, since
I've been doing backups for years and it's never blown up. I'm also
curious as to why the original coder used 'elt' as the variable name in
the form. It seems strange to use a function name as a variable name
(although admittedly harmless.)

	-paul