From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrew Gwozdziewycz Newsgroups: gmane.lisp.guile.devel Subject: Re: Strongly typed language my ass Date: Tue, 20 Sep 2022 15:17:19 -0700 Message-ID: <80B363AB-2881-493B-800E-7F0ABF21F033@gmail.com> References: <3izAWevitpu2Y1OBwQnrCwhVv4CePmVfWKxl-0oCg1yBwy1TfQcHwbHBUk9iNaZcK5WYKxmxebrZpwXAK5qM3s36qWzc1UBHH2D2XbB3jJ0=@rixotstudio.cz> Mime-Version: 1.0 (1.0) Content-Type: multipart/alternative; boundary=Apple-Mail-CF65D1E0-CBA6-4E98-8BD7-4591CCCF17E9 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1752"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-devel@gnu.org To: Jacob Hrbek Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Wed Sep 21 02:43:38 2022 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oanpy-0000JH-9E for guile-devel@m.gmane-mx.org; Wed, 21 Sep 2022 02:43:38 +0200 Original-Received: from localhost ([::1]:40486 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oanpx-00012i-Ce for guile-devel@m.gmane-mx.org; Tue, 20 Sep 2022 20:43:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oalYk-000364-Bw for guile-devel@gnu.org; Tue, 20 Sep 2022 18:17:42 -0400 Original-Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:35755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oalYi-0004sc-Gr for guile-devel@gnu.org; Tue, 20 Sep 2022 18:17:42 -0400 Original-Received: by mail-pj1-x102c.google.com with SMTP id q35-20020a17090a752600b002038d8a68fbso8258365pjk.0 for ; Tue, 20 Sep 2022 15:17:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date; bh=mNwqXZBlu5PtmflCbVF0pdcnmjtNxpudCcQdkcEybqA=; b=YuMaq0KT3PBxK0EOJOXQN24HQM+ABRU5/3d3muYJWbJMrQjWN8Oe0dHJZ++oRI1J3S GlNbLPtzGVWsDlzzQEkJDXwpArjWsP5CmTvRq9YdL5eHP8aDXOP/QpZ5U2OtlhtyOIhO AWggSFP6dFjn1bu6LdvJbdzf+lpfpiJyXvQ2EjofyoB0QuOMPAO2Gv8UfGoB57siJerO EOXM5jGMFKxMmk3tGxTJyRWQk1oK17Ki0FE2UjcUftdhZmnFtkuHGcLuiE+fp4W0tFeb n60M1CeqnnK2VzMCiWVlo44LlDC66T/H+ejjsjA8GmMUxNZ2XzhUMzO1qe6HK3+Bhi0Z Skng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date; bh=mNwqXZBlu5PtmflCbVF0pdcnmjtNxpudCcQdkcEybqA=; b=LRBi1SMo4/5Qph7MiISvVK4H9tH+ovBxSBWcgyhqoFGZSKcuqGwZwlfiUCENE2GUqZ yrB95VszXneNZHJMxhpAQ9nz2iGlL95LrF8OPIqHhF0drLIZtgJG5pxNwhKb5xh8V19+ 1USeVE1wwLgfG1sqxUJdkWpvi0/wKl2FQVpgiuJVHaNqOqYdnaG40n6ez/4i0fr5hD8W FFFVRLShVWL5kMob23EBn0NUMV6OUMvyr016Omt2x9sHAaB1DUZM9+c0w9eZGmTC0x/L PJwfCmgtV1XXnPKjEEN1VsoPBRFHZw1TaqNQZCw6KykWP+GS7qPDxfxZFJ463dGTeqbG 7kqg== X-Gm-Message-State: ACrzQf10DHJvCDo8QynLTST7pxRqTKJh7OAjhQsvKcYpdU4RiMCTaNNE N8MStQEff1IVfWtI+EKuSzvzZwWjfLY= X-Google-Smtp-Source: AMsMyM4+ay4j5+k3XA/UaEYEKE9mcZGKm9JP2HoZ29LrKYwv+KFvSDXDyS8efhmFxakcY2PoSzYpLA== X-Received: by 2002:a17:90b:3543:b0:202:aa2d:b87 with SMTP id lt3-20020a17090b354300b00202aa2d0b87mr6233405pjb.118.1663712258407; Tue, 20 Sep 2022 15:17:38 -0700 (PDT) Original-Received: from smtpclient.apple ([2607:fb90:3306:740a:e821:6e94:a65c:bcef]) by smtp.gmail.com with ESMTPSA id u10-20020a170903124a00b001782a0d3eeasm409240plh.115.2022.09.20.15.17.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Sep 2022 15:17:37 -0700 (PDT) In-Reply-To: <3izAWevitpu2Y1OBwQnrCwhVv4CePmVfWKxl-0oCg1yBwy1TfQcHwbHBUk9iNaZcK5WYKxmxebrZpwXAK5qM3s36qWzc1UBHH2D2XbB3jJ0=@rixotstudio.cz> X-Mailer: iPhone Mail (20A362) Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=apgwoz@gmail.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, MIME_QP_LONG_LINE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:21359 Archived-At: --Apple-Mail-CF65D1E0-CBA6-4E98-8BD7-4591CCCF17E9 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable The words you=E2=80=99re actually looking for are =E2=80=9Cstatically typed=E2= =80=9D and =E2=80=9Cdynamically typed.=E2=80=9D Scheme is =E2=80=9Cdynamically typed.=E2=80=9D Some people use the words =E2= =80=9Cstrongly typed=E2=80=9D to refer to the phenomena that variables must b= e explicitly converted to another type to be used in a different context. Eg= , a string cannot be added to an integer without explicit conversion of one o= f those to the other. Maybe seek definitions for these things before making inflammatory comments i= n the future? Cheers, apg > On Sep 20, 2022, at 14:44, Jacob Hrbek wrote: >=20 > =EF=BB=BF > In what world is this considered a strongly typed language when I need to d= o these checks like it's a weakly typed one? >=20 > (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 >=20 > This procedure sets an entry in the @{%makevars} hash table" >=20 > (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 descript= ive > (else (make-non-continuable-error))) >=20 > ;; FIXME-QA(Krey): Add check for sanity of VAL >=20 > (makevars-set key (delay val))) >=20 > Instead of something like: >=20 > (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 >=20 > This procedure sets an entry in the @{%makevars} hash table" >=20 > (makevars-set key (delay val))) >=20 > Notice the (string-type key) meant to declare that it's only expecting an i= nput that is a string or evaluates into a string which mitigates the need to= include sanity checking in every procedure.. >=20 > or even something like: >=20 > (define* (lazy-assign key:string #:optional (var:string "")) ...) >=20 > -- Jacob "Kreyren" Hrbek --Apple-Mail-CF65D1E0-CBA6-4E98-8BD7-4591CCCF17E9 Content-Type: multipart/mixed; boundary=Apple-Mail-567670AB-1ED7-4387-B25A-086589B68E01 Content-Transfer-Encoding: 7bit --Apple-Mail-567670AB-1ED7-4387-B25A-086589B68E01 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
The= words you=E2=80=99re actually looking for are =E2=80=9Cstatically typed=E2=80= =9D and =E2=80=9Cdynamically typed.=E2=80=9D

Scheme is =E2=80=9Cdynamically typed.=E2=80=9D Some people= use the words =E2=80=9Cstrongly typed=E2=80=9D to refer to the phenomena th= at variables must be explicitly converted to another type to be used in a di= fferent context. Eg, a string cannot be added to an integer without explicit= conversion of one of those to the other.

Maybe seek definitions for these things before making inflamm= atory comments in the future?

Cheers,

apg

On Sep 20, 2022, at 14:44, Jacob Hrb= ek <kreyren@rixotstudio.cz> wrote:

=EF=BB=BF
In what world is this considered a strongly typed languag= e when I need to do these checks like it's a weakly typed one?

<= span>    (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 t= o a string

  &nbs= p; This procedure sets an entry in the @{%makevars} hash table"
=

      (cond ((procedure? key)
    (set! key (key)))
&nb= sp;   ((string? key)
    ;; FIXME-QA(K= rey): Seems like a wasteful @{format}
    (= set! key (format #f "~a" key)))
    ;; FIXM= E-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 some= thing like:

  (de= fine* (lazy-assign (string-type key) #:optional (val ""))
  "Assign environmental variabl= e KEY with an optional value VAL, both must be a string or a thunk that eval= uates to a string

  This procedure sets an entry in the @{%ma= kevars} 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 stri= ng or evaluates into a string which mitigates the need to include sanity che= cking in every procedure..

or even something like:

  &nbs= p; (define* (lazy-assign key:string #:optional (var:string "")) ...)

=
-- Jacob "Kreyren" Hrbek
= --Apple-Mail-567670AB-1ED7-4387-B25A-086589B68E01 Content-Type: application/octet-stream; name="publickey - kreyren@rixotstudio.cz - 0x1677DB82.asc"; x-apple-part-url=5A504418-F7A1-4C3E-ACE6-0B99A062CE2F Content-Disposition: attachment; filename="publickey - kreyren@rixotstudio.cz - 0x1677DB82.asc" Content-Transfer-Encoding: 7bit -----BEGIN PGP PUBLIC KEY BLOCK----- xjMEYAl3FhYJKwYBBAHaRw8BAQdAQKApmdR8tG9aKEdxwHJ/ZKO2CvZMRWPt BNNGqJUhp2LNL2tyZXlyZW5Acml4b3RzdHVkaW8uY3ogPGtyZXlyZW5Acml4 b3RzdHVkaW8uY3o+wo8EEBYKACAFAmAJdxYGCwkHCAMCBBUICgIEFgIBAAIZ AQIbAwIeAQAhCRCt030Uq0L8qRYhBBZ324KTjKhlc4EjB63TfRSrQvyp57QA /0tlbdnCIzreKXmvW2XSYXzAJotJdxCzE+XATM+qPDKzAQCcbHp7yw6+Arng eStGFn/olhxTPdpu641CLGigPmEoBc44BGAJdxYSCisGAQQBl1UBBQEBB0Da iI3jQfSoi3DZ4/NfmxGdsRsv9/BqMgW5j6jdBqkyIAMBCAfCeAQYFggACQUC YAl3FgIbDAAhCRCt030Uq0L8qRYhBBZ324KTjKhlc4EjB63TfRSrQvypHcEB AOQxS/J/UM0ee8k2jbliWd/Q0Id+X8UHBXhyqVRc22qrAQDLHcW97WQbSJFo 19kwt70OyHepF6LWpDD0PuISZD6ICg== =9kZg -----END PGP PUBLIC KEY BLOCK----- --Apple-Mail-567670AB-1ED7-4387-B25A-086589B68E01 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit
--Apple-Mail-567670AB-1ED7-4387-B25A-086589B68E01-- --Apple-Mail-CF65D1E0-CBA6-4E98-8BD7-4591CCCF17E9--