help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Differences between Elisp and Lisp


From: Lars Magne Ingebrigtsen
Subject: Re: Differences between Elisp and Lisp
Date: Thu, 01 May 2003 05:22:08 GMT
User-agent: Gnus/5.09002 (Oort Gnus v0.20) Emacs/21.3.50 (gnu/linux)

"Stefan Monnier" <monnier+gnu.emacs.help/news/@flint.cs.yale.edu> writes:

>>>>>> "Lars" == Lars Magne Ingebrigtsen <lmi@gnus.org> writes:
>> and dispatching functions based on type would be nice.
>
> Never heard that one.  What exactly would you like to see ?

The Common Lisp `defmethod' thingie.  Which is a part of CLOS, I
guess, but wouldn't have to be.  But one would need a type system.

(defmethod do-stuff ((arg string))
  ... do stuff with a string)

(defmethod do-stuff ((arg number))
  ... do stuff with a number)

And then one could just say (do-stuff whatever) here and there.

This is really just syntactical sugar on the "pattern"

(defun do-stuff (arg)
  (cond ((stringp arg)
         ... do stuff with a string)
        ((numberp arg)
         ... do stuff with a number)))

but it's really useful.  Especially when you're able to define your
own classes.  Er, types.

Perhaps eieio already provides this?
  
-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen


reply via email to

[Prev in Thread] Current Thread [Next in Thread]