From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark H Weaver Subject: Re: 01/01: gnu: cmake: Delete Emacs library. Date: Wed, 23 May 2018 21:35:20 -0400 Message-ID: <87sh6h6dk7.fsf@netris.org> References: <20180522141738.8231.26687@vcs0.savannah.gnu.org> <20180522141741.641D120711@vcs0.savannah.gnu.org> <87d0xn7cqt.fsf@netris.org> <87y3ga9wty.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34434) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fLfBB-0004y0-Bk for guix-devel@gnu.org; Wed, 23 May 2018 21:36:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fLfB8-0003OA-7p for guix-devel@gnu.org; Wed, 23 May 2018 21:36:33 -0400 Received: from world.peace.net ([64.112.178.59]:35794) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fLfB8-0003Ns-39 for guix-devel@gnu.org; Wed, 23 May 2018 21:36:30 -0400 In-Reply-To: <87y3ga9wty.fsf@gmail.com> (Oleg Pykhalov's message of "Wed, 23 May 2018 19:10:49 +0300") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Oleg Pykhalov Cc: guix-devel@gnu.org Hi Oleg, Oleg Pykhalov writes: > Mark H Weaver writes: > >> go.wigust@gmail.com (Oleg Pykhalov) writes: >> >>> @@ -85,6 +85,12 @@ >>> " --exclude-regex ^\\(" (string-join skipped-tests "\\|") "\\)$"))) >>> #:phases >>> (modify-phases %standard-phases >>> + (add-after 'unpack 'split-package >>> + ;; Remove files that have been packaged in other package recipes. >>> + (lambda _ >>> + (delete-file "Auxiliary/cmake-mode.el") >>> + (substitute* "Auxiliary/CMakeLists.txt" >>> + ((".*cmake-mode.el.*") "")))) >> >> this new phase that you've added returns an unspecified value, although >> it is supposed to return a boolean to indicate success or failure. > > substitute* returns #t if it finds a file and error otherwise. Do I > miss understand something? Yes. You are confusing the *specification* with the behavior of the current implementation. Also, you've reached a mistaken conclusion about the behavior of the current implementation. The specification (i.e. documentation) for 'substitute*' says nothing about its return value. That's what I mean when I say that its return value is "unspecified". > scheme@(guile-user)> (substitute* "/tmp/test.txt" (("Hello") "foo")) > $3 = #t > scheme@(guile-user)> (substitute* "/tmp/test.txt" (("bla") "foo")) > $4 = #t > scheme@(guile-user)> (substitute* "/tmp/test.txtf" (("bla") "foo")) > ERROR: In procedure stat: > In procedure stat: No such file or directory: "/tmp/test.txtf" Here you've attempted to determine the specification of 'substitute*' by experiment on a few examples, and on the basis of these results have apparently concluded that: "substitute* returns #t if it finds a file and error otherwise." In fact, this conclusion is incorrect. Here's a counterexample: scheme@(guile-user)> ,use (guix build utils) scheme@(guile-user)> (define return-val (substitute* (list "HACKING" "INSTALL") (("bla") "foo"))) scheme@(guile-user)> (list return-val) $1 = (#) In general, it's a mistake to try to determine the specification of a procedure or macro by experiment, or even by analyzing its current implementation. Suppose that you examine the current implementation of some procedure and find that it always returns #t. Even so, that tells you nothing about the behavior of future implementations. If the specification of a procedure says nothing about its return value, then future implementors may legitimately feel free to pay no attention to the return value, and thereby allow the return value to be whatever happens by accident. That's why the *specification* is what you need to know when using a procedure or macro. Knowledge of the current implementation is no substitute for knowledge of the specification. Does that make sense? Regards, Mark PS: Note that although Guile has a special value # that is sometimes returned by expressions whose return value is unspecified, as in the counterexample above, in general such expressions could return _any_ Scheme value.