unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* RFC: User-defined pseudovectors
@ 2013-10-10 11:22 Lars Brinkhoff
  2013-10-10 11:29 ` Lars Brinkhoff
                   ` (2 more replies)
  0 siblings, 3 replies; 46+ messages in thread
From: Lars Brinkhoff @ 2013-10-10 11:22 UTC (permalink / raw)
  To: emacs-devel

Hello,

With the current FFI discussion, this may be a good time to ask for
input on a Lisp extension I have lying around.

Some FFI bindings may want to introduce new Lisp types.  My idea is
that this should be possible to do in Lisp, not just in C.  This might
also be useful in other situations, e.g.

- Future new pseudovector types can be defined in Lisp.

- Lisp code can potentially interoperate more easily with code in
other languages.  Existing languages for Emacs include JavaScript
(Ejacs), Python (Pymacs), Ruby (El4r), Perl (EPL), Smalltalk (Eoops),
Common Lisp (Emacs Common Lisp).

- Possibly cl-defstruct can be extended to make new types if so requested.

The gist of my patch is to add a new type of pseudovector which is
like a normal vector, except the first element holds a symbol which is
its Lisp type.  So type-of returns whatever is in the first slot.
This may sound slightly reckless, and probably is.  It's just a first
shot.

Sample session:

(let ((x (make-typed-pseudovector 3 'foo nil)))
  (aset x 1 1)
  (aset x 2 2)
  (aset x 3 3)
  (list (read-from-string (with-output-to-string (prin1 x)))
        (typed-pseudovector-p x)
        (type-of x)
        (aref x 0)
        (aref x 3)
        (length x)))

 => ((#%[foo 1 2 3] . 13) t foo foo 3 4)




^ permalink raw reply	[flat|nested] 46+ messages in thread
[parent not found: <87pokampa4.fsf@ericabrahamsen.net>]

end of thread, other threads:[~2017-03-19 12:42 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-10 11:22 RFC: User-defined pseudovectors Lars Brinkhoff
2013-10-10 11:29 ` Lars Brinkhoff
2013-10-10 11:40   ` Lars Brinkhoff
2013-10-10 12:52 ` Dmitry Antipov
2013-10-10 13:41   ` Dmitry Antipov
2013-10-10 16:40     ` Lars Brinkhoff
2013-10-10 14:00 ` Stefan Monnier
2013-10-10 16:30   ` Lars Brinkhoff
2013-10-10 20:42     ` Stefan Monnier
2013-10-11  6:00       ` Lars Brinkhoff
2013-10-11 12:22         ` Stefan Monnier
2013-10-12 16:01           ` User-defined record types Lars Brinkhoff
2013-10-12 18:58             ` Stefan Monnier
2013-10-18 13:39               ` Ted Zlatanov
2013-10-18 15:28                 ` Stefan Monnier
2013-10-18 23:24                   ` Ted Zlatanov
2013-10-19  2:09                     ` Stefan Monnier
2013-10-19  2:30                       ` Drew Adams
2013-10-19 11:48                       ` Ted Zlatanov
2013-10-19 14:37                         ` Stefan Monnier
2013-10-19 20:11                           ` Ted Zlatanov
2013-10-19 21:48                             ` Stefan Monnier
2013-10-10 20:43     ` RFC: User-defined pseudovectors Stefan Monnier
     [not found] <87pokampa4.fsf@ericabrahamsen.net>
     [not found] ` <handler.25295.B.148304476023950.ack@debbugs.gnu.org>
     [not found]   ` <8760m2mmlq.fsf@ericabrahamsen.net>
     [not found]     ` <jwv8tqsdnwl.fsf-monnier+bug#25295@gnu.org>
     [not found]       ` <87lguq5r87.fsf@ericabrahamsen.net>
     [not found]         ` <jwvr34i2s8w.fsf-monnier+emacsbugs@gnu.org>
     [not found]           ` <jwvfuky2ran.fsf-monnier+emacsbugs@gnu.org>
     [not found]             ` <jwvshoyazvd.fsf-monnier+emacsbugs@gnu.org>
     [not found]               ` <878tp0i74g.fsf@users.sourceforge.net>
     [not found]                 ` <jwvk28jmpl5.fsf-monnier+emacsbugs@gnu.org>
2017-03-02  5:36                   ` Elisp printer (was: bug#25295: Represent eieio objects using object-print in backtraces and edebug) Michael Heerdegen
2017-03-02  6:38                     ` Elisp printer Stefan Monnier
2017-03-08  4:09                       ` Tom Tromey
2017-03-08 18:17                         ` Lars Brinkhoff
2017-03-08 23:02                           ` Stefan Monnier
2017-03-14  9:52                             ` User-defined record types Lars Brinkhoff
2017-03-14 12:28                               ` Lars Brinkhoff
     [not found]                             ` <86bmt42nk2.fsf_-_@molnjunk.nocrew.org>
     [not found]                               ` <jwvzigoow0k.fsf-monnier+emacs@gnu.org>
2017-03-14 13:25                                 ` Lars Brinkhoff
2017-03-14 14:28                                   ` Lars Brinkhoff
2017-03-14 15:20                                     ` Stefan Monnier
2017-03-14 17:23                                       ` Lars Brinkhoff
2017-03-15 14:38                                         ` Stefan Monnier
2017-03-15 18:14                                           ` Lars Brinkhoff
2017-03-15 19:12                                             ` Stefan Monnier
2017-03-15 19:21                                               ` Lars Brinkhoff
2017-03-15 20:05                                                 ` Stefan Monnier
2017-03-15 21:49                                               ` Lars Brinkhoff
2017-03-15 23:42                                                 ` Stefan Monnier
2017-03-16  3:05                                               ` Stefan Monnier
2017-03-16  3:08                                                 ` Stefan Monnier
2017-03-16 20:03                                                 ` Lars Brinkhoff
2017-03-16 21:32                                                   ` Stefan Monnier
2017-03-17 11:22                                                     ` Lars Brinkhoff
2017-03-17 20:45                                                     ` Lars Brinkhoff
2017-03-18 23:24                                                 ` Stefan Monnier
2017-03-18 23:36                                                   ` Stefan Monnier
2017-03-19  9:34                                                   ` Lars Brinkhoff
2017-03-19 12:42                                                     ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).