<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body><div style="font-family: sans-serif;"><div class="markdown" style="white-space: normal;">
<p dir="auto">On 21 Oct 2022, at 15:53, Russell Sim wrote:</p>
</div><div class="plaintext" style="white-space: normal;"><blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; color: #777777;"><p dir="auto">Robert Goldman <rpgoldman@sift.info> writes:</p>
<blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; border-left-color: #999999; color: #999999;"><p dir="auto">I have been out of town and away from my email for a while. Sorry for
<br>
the late response. Checked ASDF code and I think you are right: it would
<br>
make sense to make `:read-file-form` more generally usable than just in
<br>
the `:version` property.</p>
<p dir="auto">Unfortunately, if we were to do this, it would cause new `defsystem`
<br>
forms to be backwards incompatible, which would be undesirable.</p>
</blockquote><p dir="auto">I was thinking about this and I understand the need for backwards
<br>
compatibility, I know that read time conditionals could be used to
<br>
enable backwards compatibility `#+asdf-3.4` or something of that
<br>
nature?</p>
</blockquote></div>
<div class="markdown" style="white-space: normal;">
<p dir="auto">Yes, that is correct: I expect that we would add a new feature for such constructs. See <a href="https://gitlab.common-lisp.net/asdf/asdf/-/issues/131" style="color: #3983C4;">https://gitlab.common-lisp.net/asdf/asdf/-/issues/131</a></p>
</div><div class="plaintext" style="white-space: normal;"><blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; color: #777777;"><blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; border-left-color: #999999; color: #999999;"><p dir="auto">We could probably instead add a `:license-file` `defsystem` option. We
<br>
should think carefully about how this is to be done, though. Probably
<br>
this should *not* point to a file directly, but to a component
<br>
(generally a `:static-file`): that would be desirable because using a
<br>
component already provides a mechanism for specifying the location of a
<br>
source file.</p>
<p dir="auto">At this point, though, we are starting to get a structure that is so
<br>
fussy that it is likely to cause more problems than it fixes.</p>
</blockquote><p dir="auto">I agree this sounds overly complicated for the user, introducing
<br>
dependent fields i think is too much. Would it make sense to add a
<br>
special :license-file component type like
<br>
<a href="https://gitlab.com/daewok/asdf-release-ops" style="color: #777777;">https://gitlab.com/daewok/asdf-release-ops</a> introduces? or implicitly add
<br>
a `:static-file` when a `:license-file` is declared as a `defsystem`
<br>
option?</p>
</blockquote></div>
<div class="markdown" style="white-space: normal;">
<p dir="auto">The problem with implicitly adding a <code style="margin: 0 0; padding: 0 0.25em; border-radius: 3px; background-color: #F7F7F7;">:static-file</code> from a <code style="margin: 0 0; padding: 0 0.25em; border-radius: 3px; background-color: #F7F7F7;">:license-file</code> metadata item is that metadata doesn't have a way of allowing the programmer to specify the location of the file, the way that a component does (through <code style="margin: 0 0; padding: 0 0.25em; border-radius: 3px; background-color: #F7F7F7;">pathname</code> option or the use of modules).</p>
<p dir="auto">Having a <code style="margin: 0 0; padding: 0 0.25em; border-radius: 3px; background-color: #F7F7F7;">:license-file</code> component type would work, but I hate to mix together program and meta-program that way.</p>
</div><div class="plaintext" style="white-space: normal;"><blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; color: #777777;"><p dir="auto">Supporting multiple license files is better for dual licensed projects,
<br>
so in some ways adding a new component type is the simplest.</p>
<blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; border-left-color: #999999; color: #999999;"><p dir="auto">I wonder if this is a technical problem at all. Maybe the problem is
<br>
just that developers are not putting the right static files into their
<br>
systems, and the issue is that our social practices need to be fixed,
<br>
not our code. If programmers should be putting license files in as
<br>
static files, maybe we should just be teaching them to do this.</p>
</blockquote></blockquote></div>
<div class="markdown" style="white-space: normal;">
<p dir="auto">I could have said "most of them don't even put version information in"!</p>
</div><div class="plaintext" style="white-space: normal;"><blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; color: #777777;"><p dir="auto">I think it's a combination of the 2, if the tool doesn't provide an
<br>
easy/obvious way to do fill the `:long-description` field. We are
<br>
relying on the users to copy and paste good examples, or to try and
<br>
write portable code. I do agree it's a balance, and in a library like
<br>
this it's important consider all options. Some of this could be fixed
<br>
by providing tooling and better examples.</p>
</blockquote></div>
<div class="markdown" style="white-space: normal;">
<p dir="auto">Allowing <code style="margin: 0 0; padding: 0 0.25em; border-radius: 3px; background-color: #F7F7F7;">:read-file-form</code> to be used more widely would be a reasonable extension, although it won't be backward compatible.</p>
</div><div class="plaintext" style="white-space: normal;"><blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; color: #777777;"><p dir="auto">This discussion has given me some good ideas. Like you say, it's partly
<br>
a social practices issue, which makes me think that tooling like a
<br>
linter would help. But read time evaluation makes that hard to
<br>
implement. If the need for that could be removed somehow, that would
<br>
improve things significantly. One thing that can be seen from the
<br>
`:version`, `:read-file-form` option usage below is that if there is a
<br>
better way to read a file, people will use it.</p>
<p dir="auto">Cheers,
<br>
Russell</p>
<p dir="auto">--------------------
<br>
Below are some numbers to gauge usage of existing fields and features of
<br>
ASDF. I have gone and pulled all the systems from Quicklisp so we can
<br>
look at the current usage.</p>
<p dir="auto">So looking at 4921 asd files found in quicklisp (NB, this total isn't
<br>
perfect there a few minor duplicates, ~10 due to locally having multiple
<br>
versions of some packages) But the rest of the results I manually
<br>
verified.</p>
<p dir="auto">70 asd files currently declare a license via a `:static-file` component.
<br>
1961 asd files currently declare a `:license` option</p>
<p dir="auto">76 asd files that declare the readme as either a `:static-file` or a
<br>
`:doc-file` (6 use the `:doc-file` declaration) There is some overlap
<br>
with the following libraries, but not all, so some people are correctly
<br>
declaring a `:static-file` and using read time evaluation. Sorry I was
<br>
too lazy to calculate the set difference.</p>
<p dir="auto">130 systems using read-file-string
<br>
-----------
<br>
:long-description #.(uiop:read-file-string
<br>
(uiop:subpathname *load-pathname* "README.org"))
<br>
-----------</p>
<p dir="auto">95 asd files using the `with-open-file` similar to this
<br>
-----------
<br>
:long-description
<br>
#.(with-open-file (stream (merge-pathnames
<br>
#p"README.markdown"
<br>
(or *load-pathname* *compile-file-pathname*))
<br>
:if-does-not-exist nil
<br>
:direction :input)
<br>
(when stream
<br>
(let ((seq (make-array (file-length stream)
<br>
:element-type 'character
<br>
:fill-pointer t)))
<br>
(setf (fill-pointer seq) (read-sequence seq stream))
<br>
seq)))
<br>
-----------</p>
<p dir="auto">Regarding general use of read time evaluation, there are 7 total
<br>
instances where users are incorrectly using `with-open-file` to fill the
<br>
`:version` defsystem option from a file instead of using
<br>
`:read-file-form` or equivalent line option.</p>
<p dir="auto">There are ~258 correct usages of the `:version (:read-file-form`</p>
</blockquote></div>
<div class="markdown" style="white-space: normal;">
<blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; color: #777777;">
<p dir="auto">expression.</p>
</blockquote>
</div>
</div>
</body>
</html>