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

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

RE: Something like an array (list) of a class


From: Drew Adams
Subject: RE: Something like an array (list) of a class
Date: Sun, 12 Apr 2009 10:45:54 -0700

> > One thing you might also consider (again, depending on what 
> > you need/want), is that Emacs Lisp does provide a
> > type-checking mechanism - in the context of
> > Customize. This is often overlooked or under-exploited. 
> > Customize options can be complex structures whose parts
> > are well typed, and compile-time and runtime
> > type-checking are available. In addition, you can define 
> > initialization and set/put methods/triggers.
> >
> > Whether you want to use options for your data structures in 
> > general is another question. You would be exploiting the
> > type-definition and type-checking features
> > of Customize without necessarily wanting to create 
> > user-visible options. But this type manipulation is an
> > existing and powerful Emacs-Lisp feature that you
> > can use in ways other than those originally intended.
>
> Very interesting, did you already use this kind of mechanism 
> in some of your programs ?

I haven't tried to implement data-driven or object-oriented programming in Emacs
Lisp. I do take advantage of Customize type definition and type-checking, but so
far only in the context of real user options. And I do use some options that
users are not expected to modify using the Customize UI (rather, they use
particular commands that I provide, to do that).

In general, the Customize UI is one thing, and the Customize infrastructure is
another. I suspect that many Emacs-Lisp programmers, disliking the UI, miss
taking advantage of its variable defining and modifying infrastructure.

>From my point of view, I don't care whether a user uses the UI or `setq' in an
init file. I use `defcustom' largely for its detailed type-defining features,
which are not bad. But so far I've done so only for real user options.

A few of the `defcustom' definitions in Icicles might be of interest:
http://www.emacswiki.org/emacs/icicles-opt.el. But I don't claim to be an expert
on Customize definitions. I'm sure you can find other, and more interesting,
`defcustom' definitions as food for thought. One place to look is the Emacs
source files.





reply via email to

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