From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] trunk r113747: lisp/frameset.el: Convert `frameset' to vector and add new slots. Date: Thu, 08 Aug 2013 00:09:49 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1375935010 11788 80.91.229.3 (8 Aug 2013 04:10:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 Aug 2013 04:10:10 +0000 (UTC) Cc: Emacs developers To: Juanma Barranquero Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 08 06:10:12 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V7HYB-0007wV-7R for ged-emacs-devel@m.gmane.org; Thu, 08 Aug 2013 06:10:11 +0200 Original-Received: from localhost ([::1]:43996 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7HYA-0001ew-HY for ged-emacs-devel@m.gmane.org; Thu, 08 Aug 2013 00:10:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7HY1-0001Ll-2d for emacs-devel@gnu.org; Thu, 08 Aug 2013 00:10:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V7HXq-0000Ov-S8 for emacs-devel@gnu.org; Thu, 08 Aug 2013 00:10:01 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:60950) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7HXq-0000Or-NI for emacs-devel@gnu.org; Thu, 08 Aug 2013 00:09:50 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFLd/Nq/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IPAS-Result: Av4EABK/CFFLd/Nq/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="20951640" Original-Received: from 75-119-243-106.dsl.teksavvy.com (HELO ceviche.home) ([75.119.243.106]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 08 Aug 2013 00:09:43 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id B6C1E66084; Thu, 8 Aug 2013 00:09:49 -0400 (EDT) In-Reply-To: (Juanma Barranquero's message of "Thu, 8 Aug 2013 05:17:13 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.182 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:162484 Archived-At: > 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. So we agree: the return value should be treated as a boolean, even if it may not always be restricted to t or nil. So it shouldn't document its return value as being something else. > 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. Actually, if we ever want to save those vectors to a file, then I agree that `frameset' is indeed better than `cl-defstruct-frameset'. I had forgotten about this point. > 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. Then why don't you remove make-frameset and replace it with a good constructor which can only build elements that agree with your tighter constraints? You wouldn't need to check those constraints in frameset-p any more since they'd be true by construction. >> That's it's more idiomatic? > A predicate is something that checks inclusion in a type. Indeed. Not something that returns a version number. > [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. It's a frameset, it's just not a valid one. If/when cl-defstruct is extended to support type annotations on its slots, then I might agree with you, but note that if this ever happens, the type checks will not be in frameset-p but in the constructors and the setters. Stefan