From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Damien Mattei Newsgroups: gmane.lisp.guile.user Subject: Re: wayland client in Guile without libwayland-client Date: Sat, 19 Nov 2022 05:26:53 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20333"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Guile User To: Matt Wette , =?UTF-8?Q?Linus_Bj=C3=B6rnstam?= Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Nov 19 05:28:00 2022 Return-path: Envelope-to: guile-user@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 1owFSR-000564-Eb for guile-user@m.gmane-mx.org; Sat, 19 Nov 2022 05:27:59 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1owFRg-0005Ls-9G; Fri, 18 Nov 2022 23:27:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1owFRd-0005LU-IH for guile-user@gnu.org; Fri, 18 Nov 2022 23:27:09 -0500 Original-Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1owFRb-00089y-EE for guile-user@gnu.org; Fri, 18 Nov 2022 23:27:09 -0500 Original-Received: by mail-ej1-x62b.google.com with SMTP id f27so17599299eje.1 for ; Fri, 18 Nov 2022 20:27:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=LYns6pThwfFzmAqho+/6iZSgdDZ01rTF8pzFmFSG6MM=; b=oiXqlyxW6/52VBu/1TmMOdcqcfdGs3cYCwAmyC0mI7Qd8qLI05UIH0rSMrxI5/fDmd EgfSKkvdBmNvKM5K6sJMSydnRRAyaL/u5IzUdvYGXYu8d27NlZFAiO5Eyri+vnciA3/Z p9pGRXpXJHgFWgcM8sqRRo+svT1Q5cloOv3M1mLXdxrvtVWc2WK4HfXyt+DCtpw+7q2O rUa37CSeofj4XrIiIKEjPgrpjwSY3RC3xSgY5nr8cbi34trk8dJKAYD8COFEWZYXYOnS 66L0m11uJCYc49NDmCY+IKJZC0IwvWiwtf0Dv82lT+Ld5zquD05LdsKK0QoIfYO28kWQ faow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LYns6pThwfFzmAqho+/6iZSgdDZ01rTF8pzFmFSG6MM=; b=Ee4WJRuL7y+VPf0iDyOeMYhyg+Z/of5hnlKuT9DSDYS7m+cELpmFZjS3DB4CJniPub xDG/mDdHn0kpj/t9FKjMeWkI/JFtS+/Im+OhURKfcfrxqZPxhZo7J04GxRpGai5dcN9V S4f3Jh/8LewC2aY0nbPQey6+RqI6/MsV+MTAtsAfeKb37W2NvA6KS3u9pSwMefU6te7M 97QGAe41/+EVbcv9eIuTH3USsqMiF3GInEWcuUzR2m4+JHknE3jYfAbHEK4WVZ44FirN jUu7EzSaSYdO7nbZCkB+apQkEIaDxYqZONO6RsKV3UXAHPVlTm5PKfqXVEYhDOJmKToi 1rMg== X-Gm-Message-State: ANoB5pntCgopJSBg5l0SURL9eMvrc7xHRDTip10OU7rXj2Rb29uMe1EM U/WtwIo/4SmkX3Nk/fXd4JhbmH5cLaqBz/rPgiU= X-Google-Smtp-Source: AA0mqf5NiPKWsjfy8Sa0DckXeyvy6IfkXDyYDqY28kRf1DlwBxOk9FyzZ0cGvauga6siWrpVhJm+JsY2Xf6zFHBta0Y= X-Received: by 2002:a17:906:f05:b0:7b2:c575:2ee8 with SMTP id z5-20020a1709060f0500b007b2c5752ee8mr3686680eji.136.1668832025036; Fri, 18 Nov 2022 20:27:05 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=damien.mattei@gmail.com; helo=mail-ej1-x62b.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, 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-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:18741 Archived-At: hello, it is just a question about semantic and aside the subject of project, and related to another subject of internal definitions that Linus is talking about: On Fri, Nov 18, 2022 at 5:55 PM Matt Wette wrote: > > Here is an example of an auto-coded event decoder: > > (lambda (obj-id bv ix cm) > "event decoder for global" > (let*-values > (((name ix) (dec-u32 bv ix)) > ((interface ix) (dec-string bv ix)) > ((version ix) (dec-u32 bv ix))) > (values obj-id name interface version))) > > > i was just thinking how i would write the procedure above in Scheme+ ( https://github.com/damien-mattei/Scheme-PLUS-for-Guile ) that has feature for multiple values. this code could be rewritten like that: (lambda (obj-id bv ix cm) "event decoder for global" {(name ix) <+ (dec-u32 bv ix)} {(interface ix) <+ (dec-string bv ix)} {(version ix) <+ (dec-u32 bv ix)} (values obj-id name interface version)) note that <+ is an "operator" that allows multiple values definitions. but it would fails to compile because of multiple redefinition of ix variable: scheme@(guile-user)> (use-modules (Scheme+)) scheme@(guile-user)> (lambda (obj-id bv ix cm) "event decoder for global" {(name ix) <+ (dec-u32 bv ix)} {(interface ix) <+ (dec-string bv ix)} {(version ix) <+ (dec-u32 bv ix)} (values obj-id name interface version)) While compiling expression: Syntax error: unknown file:7:0: invalid or duplicate identifier in definition in form (lambda (obj-id bv ix cm) "event decoder for global" (<+ (name ix) (dec-u32 bv ix)) (<+ (interface ix) (dec-string bv ix)) (<+ (version ix) (dec-u32 bv ix)) (values obj-id name interface version)) a longer and a bit unsightly solution could be: (lambda (obj-id bv ix cm) "event decoder for global" (declare name interface version) {(name ix) (lambda (obj-id bv ix cm) "event decoder for global" (declare name interface version) {(name ix) :16:24: warning: possibly unbound variable `dec-u32' ;;; :17:29: warning: possibly unbound variable `dec-string' $3 = #:13:0 (obj-id bv ix cm)> the first example fails not because of my Scheme+ language extension but because in scheme redefinition is only allowed at toplevel or in the REPL. Would it not be a good idea to allow redefinitions in Scheme and Guile not only at toplevel or REPL but in procedure definitions and lambda, in their bodies? personaly i can not see any "bad" side effect or consequences... of course it relax the possibility of code error by unchecking a redefinition of variable but it is like in C++ where you can define private or protected variables but even with protective language feature one can wrote bad code... Best regards, Damien