all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: Bruno Victal <mirai@makinata.eu>
Cc: 67842@debbugs.gnu.org
Subject: [bug#67842] [PATCH 4/4] services: mympd: Refactor serialization process.
Date: Sat, 16 Dec 2023 23:12:49 +0100	[thread overview]
Message-ID: <c6c6755bb0b9f5f863b9f9ab1905c960c5c53644.camel@gmail.com> (raw)
In-Reply-To: <9283714a-991e-436a-bb83-fb9254cba5a2@makinata.eu>

Am Samstag, dem 16.12.2023 um 19:36 +0000 schrieb Bruno Victal:
> 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)
I don't think we have to make this distinction that often, though; and
if we do, there are more fitting descriptions like signed-integer and
unsigned-integer.  Even if it's to guard against silly inputs, most
folks wouldn't write 8080.0 there.

> --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)
Maybe port-number? is clearer?

> 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.
From my point of view you are already introducing "this kind of change"
as not a separate series :)

Cheers




      reply	other threads:[~2023-12-16 22:13 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
2023-12-16 22:12       ` Liliana Marie Prikler [this message]

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=c6c6755bb0b9f5f863b9f9ab1905c960c5c53644.camel@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=67842@debbugs.gnu.org \
    --cc=mirai@makinata.eu \
    /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.