emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] trunk r113747: lisp/frameset.el: Convert `frameset' to


From: Juanma Barranquero
Subject: Re: [Emacs-diffs] trunk r113747: lisp/frameset.el: Convert `frameset' to vector and add new slots.
Date: Thu, 8 Aug 2013 05:17:13 +0200

On Thu, Aug 8, 2013 at 4:46 AM, Stefan Monnier <address@hidden> wrote:

> I don't really care that it doesn't always return t as non-nil value.

OK.

> But its non-nil value should be treated by its docstring (and by
> callers) as a boolean equivalent to t.  Otherwise it's not just
> a "predicate" but an accessor.

Not in CL parlance: a predicate is "a function that returns a
generalized boolean as its first value." No other restrictions. It's
the callers' responsibility to treat its result as a boolean.

Yes, I'm aware this is elisp and not CL. Unfortunately.

> You can use the built-in frameset-p (and then remove the :named
> and :type as well, so that the tag becomes internal/hidden, which
> I also find cleaner)).

Both are hidden, as it is something that you don't ever see (except,
in this case, in the frameset-p predicate). But, if you ever happen to
see the tag, cl-struct-frameset is horrible. "cl-defstruct-" is jus
the implementation leaking.

  C:\> sbcl
  This is SBCL 1.1.4.0.mswin.1288-90ab477, an implementation of ANSI
Common Lisp.
  More information about SBCL is available at <http://www.sbcl.org/>.
  [...]
  * (defstruct frameset a b c)

  frameset
  * (make-frameset)

  #S(frameset :a nil :b nil :c nil)

which is much nicer (even after #S).

But the deeper question is, I really prefer to have a more checking
frameset-p. I want to discourage people of going the make-frameset
route and using frameset-save instead.

   J

> That's it's more idiomatic?

A predicate is something that checks inclusion in a type.
[cl-struct-frameset "Hello" "Goodbye" 'nothing 'to 'see 'here [0 0 0]]
is not a frameset, even if the built-in frameset-p thinks so.

    J



reply via email to

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