From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keisuke Nishida To: Kalle Olavi Niemitalo Cc: guile-emacs@sourceware.cygnus.com Subject: Re: Emacs Scheme interface Date: Wed, 29 Mar 2000 16:57:00 -0000 Message-id: References: <87n1njuww0.fsf@PC486.Niemitalo.LAN> <87g0tavmox.fsf@PC486.Niemitalo.LAN> X-SW-Source: 2000-q1/msg00075.html Kalle Olavi Niemitalo writes: > > > (lisp-eval '(current-global-map)). > > > > I don't think it is a good interface. It is harder to understand and > > may not work in the future. > > But at least it is easy to grep for "lisp-eval" when there is a > better interface. It is more difficult to convert from the > current ((point)) syntax. Either is not good. That's why I think we should think of a better interface soon. > When importing a procedure, we should think of the value it > returns. Numbers and strings should be copied. Lists perhaps > too, if they are short and don't have to be modified in place. > Keymaps and strange objects like buffers can be Lisp references > for now; new Scheme types should be defined later. > > I suppose things would be easier with Ken Raeburn's patches. :-) We can use GOOPS without changing the current C level interface, as I wrote in another email; however, if we want to create GOOPS objects automatically according to the type of return values from Lisp functions, adding class information to Lisp references may be convenient: (define (lispref->object lispref) (let ((obj (make (lispref-class lispref)))) (set! (lispref obj) lispref) obj)) (lispref->object (lisp-eval '(current-buffer))) => #< ...> Note that we cannot always rely on the value of lispref-class since Emacs uses integers as the representation of characters. We want to distinguish integers and characters in Emacs Scheme. (Is there any way to do that correctly?) (I guess we'd better always create Scheme integers instead of references to Lisp integers for performance reasons. This breaks consistency, but that would be okay since programmers is discouraged from using lisp-eval directly. Maybe we should rename it %lisp-eval or something.) -- Kei