unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Jean Abou Samra <jean@abou-samra.fr>
To: Jacob Hrbek <kreyren@rixotstudio.cz>
Cc: guile-devel@gnu.org
Subject: Re: Strongly typed language my ass
Date: Tue, 20 Sep 2022 23:58:48 +0200	[thread overview]
Message-ID: <47D877C0-2573-4C35-9D23-D2E80B351ABB@abou-samra.fr> (raw)
In-Reply-To: <3izAWevitpu2Y1OBwQnrCwhVv4CePmVfWKxl-0oCg1yBwy1TfQcHwbHBUk9iNaZcK5WYKxmxebrZpwXAK5qM3s36qWzc1UBHH2D2XbB3jJ0=@rixotstudio.cz>

[-- Attachment #1: Type: text/plain, Size: 1746 bytes --]



> Le 20 sept. 2022 à 23:44, Jacob Hrbek <kreyren@rixotstudio.cz> a écrit :
> 
> 
> In what world is this considered a strongly typed language when I need to do these checks like it's a weakly typed one?
> 
>     (define* (lazy-assign key #:optional (val ""))
>       "Assign environmental variable KEY with an optional value VAL, both  must be a string or a thunk that evaluates to a string
> 
>     This procedure sets an entry in the @{%makevars} hash table"
> 
>       (cond ((procedure? key)
>     (set! key (key)))
>     ((string? key)
>     ;; FIXME-QA(Krey): Seems like a wasteful @{format}
>     (set! key (format #f "~a" key)))
>     ;; FIXME-QA(Krey): Make sure that the error here is clear and descriptive
>     (else (make-non-continuable-error)))
> 
>       ;; FIXME-QA(Krey): Add check for sanity of VAL
> 
>       (makevars-set key (delay val)))
> 
> Instead of something like:
> 
>   (define* (lazy-assign (string-type key) #:optional (val ""))
>   "Assign environmental variable KEY with an optional value VAL, both must be a string or a thunk that evaluates to a string
> 
>   This procedure sets an entry in the @{%makevars} hash table"
> 
>   (makevars-set key (delay val)))
> 
> Notice the (string-type key) meant to declare that it's only expecting an input that is a string or evaluates into a string which mitigates the need to include sanity checking in every procedure..
> 
> or even something like:
> 
>     (define* (lazy-assign key:string #:optional (var:string "")) ...)
> 
> -- Jacob "Kreyren" Hrbek




https://www.gnu.org/software/guile/manual/html_node/GOOPS.html

Writing that denigrates is unlikely to attract helpful responses. I won’t reply further.


[-- Attachment #2: Type: text/html, Size: 3207 bytes --]

  reply	other threads:[~2022-09-20 21:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20  9:01 Strongly typed language my ass Jacob Hrbek
2022-09-20 21:58 ` Jean Abou Samra [this message]
2022-09-20 22:17 ` Andrew Gwozdziewycz

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

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47D877C0-2573-4C35-9D23-D2E80B351ABB@abou-samra.fr \
    --to=jean@abou-samra.fr \
    --cc=guile-devel@gnu.org \
    --cc=kreyren@rixotstudio.cz \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).