3 ms·
I don't understand the argument for using a hash-table for kw-args. Hash tables only win against plists when you don't need to read every single element; when
by aidenn0 13y ago
I don't understand the argument for using a hash-table for kw-args. Hash tables only win against plists when you don't need to read every single element; when you always need to read every single element, then it's a losing proposition to use a hash-table instead of a plist.
Yes I agree with your later comment about syntactic blessing and all, but I think you picked a terrible example by choosing the single place in lisp where plists make more sense than hash tables.
- ANTSANTS 13y agoMaybe it was a bad example, but in either case, I would expect a "sufficiently smart compiler" to transform (defun fun (a &key (b 0) (c 0)) ...) (fun 5 :b 3) into something like (defun fun (a b c) ...) (fun 5 3 0) Whether it does so as a regular macro or as a special form of the compiler doesn't matter, there's no need for there to be any difference in efficiency between representing keyword args with tables or plists. As I later mentioned in another comment, it was a mistake to talk about hash tables when I was really more interested in the abstract map datatype.