From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id gCL3JJYN2WJXVgEAbAwnHQ (envelope-from ) for ; Thu, 21 Jul 2022 10:25:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 4PvlJJYN2WItLwAAauVa8A (envelope-from ) for ; Thu, 21 Jul 2022 10:25:58 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 68A7C28008 for ; Thu, 21 Jul 2022 10:25:58 +0200 (CEST) Received: from localhost ([::1]:54552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oERVN-0002bd-FZ for larch@yhetil.org; Thu, 21 Jul 2022 04:25:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEJZp-000066-Ki for help-guix@gnu.org; Wed, 20 Jul 2022 19:58:01 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]:38686) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oEJZn-0006jT-Dr for help-guix@gnu.org; Wed, 20 Jul 2022 19:58:01 -0400 Received: by mail-ej1-x636.google.com with SMTP id l23so324794ejr.5 for ; Wed, 20 Jul 2022 16:57:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sweatshoppe-org.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=Zlydp+yeOxyq0xfdFh7glUbb2qDttbNOBzkg5TkiQy4=; b=wasuBgeLaWFFGvV5gojsCpIoqIae+iPY4AkH7hM+tbZT+0vTMAm2Xo3wA5ak3+Bhbx vhYLewpoX/kxc6O0upQnIirYzyNNcFsJhjYUQgnNzstgAVA7Sr70uaAHFy4MSihDecB3 2eMfJJ1dKV5YdLcqMDm053gI1jGLX2EuH44k1RYLq+BGSoKGH6KSaqxUDaxFlHEvjdUd knQly95v7U4T7SVWPkxg8kbxYeSY3Fz7yepkCLTj9Nx4kMBZrpnMPhZoQ/qd14iAZ99c FlAGzccZ6adc5K3F4wCLAShxpA2QjE5eHtJ2yf9Nsb49kdiRjWjT8vla3jQ9mFXe8efl /2FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=Zlydp+yeOxyq0xfdFh7glUbb2qDttbNOBzkg5TkiQy4=; b=Kh89sjXvclP5CDhdTgs9z+iFJAP3pzvblzT/wNY2qxkesbvKR51kDvy8MWuP4XVbPO /1UVVNb0GRahDJyNnca9nctinvev/IxjeNvP/7F+RdYn+HxOrWUFj3oKhCa8ExQfZ4s1 MSk4WJyWEOP17FW9t3LHSrTwwaupFQcqexvsXLHZ6BeuK7Mp3wa6D+htjbqnceVchpqG tQoL0XBDIz7NnmwZo7S37OFkwiyXc0hsXziAgKXkCBNVKoQalzpwUEwpLTVNvy7bIJc8 TlOMN8wuoZEHLnmy1r82SyvqT4cxe6DuaXfD4YDMcrTcsI/u9QZ/RVDuq1f2e4bBHnY2 edSg== X-Gm-Message-State: AJIora/dcV1AGbagjwuBWKuUIEukYkj4tWasNYADyLpLx2Eqi6+164Eh VBknrdJWoBrvIHQafIGZnOtU0Gj/fTt9YRYiphYCBaLEg1dfDQ== X-Google-Smtp-Source: AGRyM1vkTOB2SFq1DYotU23/kbVHOOCt6iyvKwswdpRFtDbPrGmmx+amtQHISqMKlrJ+uH8WRIxv8YpQj0LaPMSko3g= X-Received: by 2002:a17:907:94c6:b0:72f:2367:24b8 with SMTP id dn6-20020a17090794c600b0072f236724b8mr18250304ejc.46.1658361477394; Wed, 20 Jul 2022 16:57:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Blake Shaw Date: Wed, 20 Jul 2022 23:57:46 +0000 Message-ID: Subject: Re: boiler plate generation with hygenic macros in guile To: help-guix@gnu.org Received-SPF: none client-ip=2a00:1450:4864:20::636; envelope-from=blake@sweatshoppe.org; helo=mail-ej1-x636.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 21 Jul 2022 04:25:42 -0400 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1658391958; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=E7GMuJAjC1a/TsjCsO+QLFcJWPrlVUQ5urA9TqZZ/qA=; b=EB1siFkCMGOc4KODw/nxcfb82Z2hYh/a130ctuk9fH2Jj11Nj11woN8XTaJOcJYxL52CtF c/gxIRoj7+M/8JwDBUPOLaEB8lrg75mTC92M7Wm1DLahVq+kzykqkx4OOHTP1h7fzUkSr1 URhJtvLeKvBZ/RzdbP5s0CE6EFTBHFTTZEuqb4f+91G4j9SpYdjfh1UxIhN4XGQUlKGyNs yZENLCiVuE1bFnQMB9Jijj26XzNnGX9MHjcLXPq6oaX+NVfZi6To8N7o+TAJPPC50VeOpM fDrLV9PJeMOoCIYSy3sB7lvkBjqQIo3xvsg/mz7+j6rVXLzB5agW7DXTW02maw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1658391958; a=rsa-sha256; cv=none; b=K1/7AyBEipS3/ISLGdU25c+dZOQrB+X4nOisBlDpUUgA8R7laG+NyPhPeTzJZXfm+ZcdlD ea8DSWaLNxNrjT068hipxoHxI/ipILek0NLtheNUovZF4ICYegEKBLSzpwGRpZePuQFgsd ckpx3k1NDFmE5fNBe48+xg3cY2krjV9NI6arr0zKiG8qSyEzJxyDOmi+c0oJ2RiZ848ycJ NR7iIDzaLtikLXwjKZ1D3a71Ln7Nj/IYxWvzJE7a41I99VA0Wr00VgNzEW7UErHlCg7gK5 FTEZ/zNc4y3VpMtdWEo7Y9r9ObG5bApaT6tLHInLh4YexR8WiYG3KHkQImQcVg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=sweatshoppe-org.20210112.gappssmtp.com header.s=20210112 header.b=wasuBgeL; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 0.97 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=sweatshoppe-org.20210112.gappssmtp.com header.s=20210112 header.b=wasuBgeL; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 68A7C28008 X-Spam-Score: 0.97 X-Migadu-Scanner: scn0.migadu.com X-TUID: 0f0c6mHNHPJK Ah! sorry, let me begin again: Right now I am working on a window manager extension system in Guile and GOOPs, and I want to eliminate the boilerplate for generating class slots, with a syntax-case macro like: #+begin_example scheme (define-syntax slot-machine (=CE=BB (form) (syntax-case form () ((_ category quality value) #'(let* ((sym (symbol-append category '- quality)) (set-sym! (symbol-append 'set- sym '!)) (get-sym (symbol-append 'get- sym)) (acc-sym (symbol-append 'acc- sym))) (if (or (symbol? value) (string? value) (number? value)) (quasiquote (,sym #:init-value value #:setter ,set-sym! #:getter ,get-sym #:accessor ,acc-sym)) (quasiquote (,sym #:init-form value #:setter ,set-sym! #:getter ,get-sym #:accessor ,acc-sym)))))))) #+end_example With this I can call (slot-machine 'inner 'color "green") to produce what looks like an acceptable slot definition: =3D> (inner-color #:init-value "#BF3D52" #:setter set-inner-color! #:getter get-inner-color #:accessor acc-inner-color) Indeed, if I define a class with this slot definition in place, it works fine: #+begin_example scheme (define-class () (inner-color #:init-value "#BF3D52" #:setter set-inner-color! #:getter get-inner-color #:accessor acc-inner-color)) (describe ) =3D> is a class. It's an instance of Superclasses are: Directs slots are: inner-color (No direct subclass) Class Precedence List is: Class direct methods are: Method #< ( ) 7f7b27e10ac0> Generic: setter:acc-inner-color Specializers: Method #< () 7f7b27e10b00> Generic: acc-inner-color Specializers: Method #< ( ) 7f7b27e10b40> Generic: set-inner-color! Specializers: Method #< () 7f7b27e10b80> Generic: get-inner-color Specializers: #+end_example But if I try to use `slot-machine` inside a class definition i'm out of luck: (define-class () (slot-machine 'inner 'color "green")) =3D> While compiling expression: Syntax error: socket:7257:0: source expression failed to match any pattern in form (define-class-pre-definition ((quote inner) (quote color) "green")) I have tried to remedy this ina number of ways, using datum->syntax, quasisyntax/unsyntax, make-variable and by defining a new syntax-case macro to define classes, all without luck. This is actually a recurring theme with my experience with Guile, working on a project, needing to generate boilerplate, and then being unable to find a result, so I figured its time I reach out to figure out what I'm doing wrong in this situation. Thanks for your help! Best, Blake