[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 01/01: gnu: cmake: Delete Emacs library.
From: |
Mark H Weaver |
Subject: |
Re: 01/01: gnu: cmake: Delete Emacs library. |
Date: |
Wed, 23 May 2018 21:35:20 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) |
Hi Oleg,
Oleg Pykhalov <address@hidden> writes:
> Mark H Weaver <address@hidden> writes:
>
>> address@hidden (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 = (#<unspecified>)
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 #<unspecified> 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.