From: Bruno Victal <mirai@makinata.eu>
To: Liliana Marie Prikler <liliana.prikler@gmail.com>
Cc: 67842@debbugs.gnu.org
Subject: [bug#67842] [PATCH 4/4] services: mympd: Refactor serialization process.
Date: Sat, 16 Dec 2023 19:36:21 +0000 [thread overview]
Message-ID: <9283714a-991e-436a-bb83-fb9254cba5a2@makinata.eu> (raw)
In-Reply-To: <ccbd11dc1758a8a699362ccd017ef3cb3539c97d.camel@gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 2199 bytes --]
Hi Liliana,
On 2023-12-16 01:44, Liliana Marie Prikler wrote:
> Am Freitag, dem 15.12.2023 um 21:02 +0000 schrieb Bruno Victal:
>> -(define-maybe/no-serialization integer)
>> +(define-maybe/no-serialization exact-integer)
> At the risk of asking a silly question, what's the difference between
> an integer and an exact integer?
IIUC it has to do with whether a decimal point is present or not,
which influences the serialization process. (e.g. having port set
to 8080.0 doesn't make much sense even though it is an integer)
--8<---------------cut here---------------start------------->8---
$ cat integer-dem.scm
#!/usr/bin/env -S guile --no-auto-compile
!#
(for-each
(lambda (s)
(format #t "Formatted output: ~a~%" s)
(format #t "number->string: ~a~%" (number->string s))
(format #t "Integer? ~a~%" (integer? s))
(format #t "Exact-integer? ~a~%" (exact-integer? s))
(newline))
(list 64 128.0))
$ ./integer-dem.scm
Formatted output: 64
number->string: 64
Integer? #t
Exact-integer? #t
Formatted output: 128.0
number->string: 128.0
Integer? #t
Exact-integer? #f
--8<---------------cut here---------------end--------------->8---
>> (port
>> - (maybe-port 80)
>> - "HTTP port to listen on.")
>> + (maybe-exact-integer 80)
> Losing the information that this is a port (i.e. only integers that fit
> into a uint16 are valid) is imho not great.
I'm not too happy with this either, though in hindsight I think
redefining 'port?' (from Guile Ports) was a bad idea. At the moment
the (re)defined port? predicate only checks whether the value is an
integer, so switching it to exact-integer doesn't seem to change things
much. (other than being stricter in criteria)
Alternatively we could have a proper predicate, perhaps named ip-port?
that would not only perform the exact-integer? check, but also test
whether it fits within a uint16. I'm more inclined to introduce this
kind of change in a separate series that would define it in a reusable
manner and perform a cleanup run across the existing services though.
--
Furthermore, I consider that nonfree software must be eradicated.
Cheers,
Bruno.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2023-12-16 19:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-15 20:59 [bug#67842] [PATCH 0/4] Refactor mympd service Bruno Victal
2023-12-15 21:02 ` [bug#67842] [PATCH 1/4] doc: Remove missed hunk of revert commit for MPD service Bruno Victal
2023-12-15 21:02 ` [bug#67842] [PATCH 2/4] tests: mympd: Simplify test Bruno Victal
2023-12-15 21:02 ` [bug#67842] [PATCH 3/4] services: mympd: Fix syslog logging and missing service destructor Bruno Victal
2023-12-15 21:02 ` [bug#67842] [PATCH 4/4] services: mympd: Refactor serialization process Bruno Victal
2023-12-16 1:44 ` Liliana Marie Prikler
2023-12-16 19:36 ` Bruno Victal [this message]
2023-12-16 22:12 ` Liliana Marie Prikler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9283714a-991e-436a-bb83-fb9254cba5a2@makinata.eu \
--to=mirai@makinata.eu \
--cc=67842@debbugs.gnu.org \
--cc=liliana.prikler@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.