[slime-devel] Re: custom tweaks for object system

Helmut Eller heller at common-lisp.net
Wed Aug 20 12:43:39 UTC 2008


* David O'Toole [2008-08-20 09:15+0200] writes:

>
> The syntax is [method-name object &rest args] and <foo> represents
> (field-value self :foo)

You probably need to write some parsing code for this on the Emacs side.

I would recommend to use short operator names instead of reader macros.
My favorites are:

  (! message object args ...)  ; send message
  (@ slot object)              ; fetch slot 
  (@ slot)                     ; could be (@ slot self)
  
This has the advantage that all the sexp moving commands just work.  I
also found it quite hard to close parens for things ([(...)]). Typing
three parens in a row ))) is much easier than the fiddling needed to
properly match ( with ) and [ with ].

There is some code in contrib/swank-arglists.lisp which understands
things like (make-instance 'class ...).  That could probably be reused
by adding methods for @ and !.  

However, in the absence of static type information, it's almost
impossible to deduce the arglist of those methods.  It may work for
methods with a unique name, but if different classes have methods with
the same names (ala "add") it's hard to know which class should be used.
Java IDEs can do this easily due to the static nature of the language,
but it requires a lot of work for dynamic languages, like Smalltalk or
Python.

Helmut.




More information about the slime-devel mailing list