[parenscript-devel] ((slot-value list 'push) new-element) is WRONG
John Fremlin
john at fremlin.org
Wed Oct 7 03:48:10 UTC 2009
Not to pick on anybody but Common Lisp is not scheme!
((slot-value list 'push) new-element) is not Common Lisp. If anything it
should be (funcall (slot-value list 'push) new-element)
I'm not sure that (slot-value ...) is even a good idea, because
JavaScript's objects can have new slots added willy nilly.
How about two new forms? One for the current use of
slot-value, and one for method calls?
How about (object-path a b c d) for a.b.c.d?
Of course, don't call it object-path but something really short, like
'o'. Then we wouldn't need a reader macro :-)
Someone suggested using @ for method calls. Is that available already?
[...]
> I've been tasked with re-adding the shorthand syntax to parenscript [0]
> in the symbol-syntax if you need these features. Right now it only does
> (.method ...) syntax, but sometime today or tomorrow I'll have
> (foo.bar.baz) expanding to ((slot-value foo 'bar) 'baz). I'm not sure
> whether it is worthwhile keeping foo[bar] syntax; (aref foo bar) is not
> particularly less convenient.
foo.bar.baz expanding to (slot-value (slot-value foo 'bar) 'baz) is a
bit weird. These are not really slots, as the aref example suggests
. . . maybe gethash?
On the other hand, slot-value is a good idiomatic conversion, so perhaps
it's better to let this sleeping dog lie
[...]
More information about the parenscript-devel
mailing list