[parenscript-devel] ((slot-value list 'push) new-element) is WRONG

Vladimir Sedach vsedach at gmail.com
Wed Oct 7 08:51:30 UTC 2009


> ((slot-value list 'push) new-element) is not Common Lisp. If anything it
> should be (funcall (slot-value list 'push) new-element)

Funcall is already there; I'm going to take this as a vote to remove
the Scheme-like function calling convention (I also think it's a good
idea).

> 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?

Something like slot-value is needed (see below about @), but why is
everyone obsessing about special syntax for method calls? JavaScript
does not have any special syntax for method calls aside from the
arglist curly braces (which is just the JS equivalent of funcall).

> 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?

Yes. I'm going to interpret this as a vote to remove 'slot-value' and
keep just the '@' because 'slot-value' does not behave anything like
its CL equivalent. I think this idea has some merit.

I think the problem you are expressing John is that people have too
many ways to do things in Parenscript which basically wind up as
syntactic sugar. I like the sentiment and I'm going to put it into
practice.

Vladimir

> [...]
>> 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
>
> [...]
>
>
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>




More information about the parenscript-devel mailing list