Mikael Djurfeldt writes: Hi Mikael,
> Since there are no comments, I'm inclined to apply this patch. I will do > that on Sunday if there are no comments before that. Just FYI, have you seen the attached patch by Mark Weaver? I've been carrying that for some time now, functionality like this is very welcome. Greetings, Janneke
>From f4d73b5590cd2e6ff30341aa824a3f1005b50220 Mon Sep 17 00:00:00 2001 From: Mark H Weaver <m...@netris.org> Date: Fri, 15 Apr 2022 11:11:16 +0200 Subject: [PATCH] Add define-method* for GOOPS. Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 * dzn/define-method-star.scm: New file. * dzn/local.mk (dist_%C%_scm_DATA): Add it. --- dzn/define-method-star.scm | 40 ++++++++++++++++++++++++++++++++++++++ dzn/local.mk | 1 + 2 files changed, 41 insertions(+) create mode 100644 dzn/define-method-star.scm diff --git a/dzn/define-method-star.scm b/dzn/define-method-star.scm new file mode 100644 index 0000000000..a958907e35 --- /dev/null +++ b/dzn/define-method-star.scm @@ -0,0 +1,40 @@ +;;; Dezyne --- Dezyne command line tools +;;; +;;; Copyright © 2015 Mark H Weaver <m...@netris.org> +;;; +;;; This file is part of Dezyne. +;;; +;;; Dezyne is free software: you can redistribute it and/or modify it +;;; under the terms of the GNU Affero General Public License as +;;; published by the Free Software Foundation, either version 3 of the +;;; License, or (at your option) any later version. +;;; +;;; Dezyne is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; Affero General Public License for more details. +;;; +;;; You should have received a copy of the GNU Affero General Public +;;; License along with Dezyne. If not, see <http://www.gnu.org/licenses/>. +;;; +;;; Commentary: +;;; +;;; Code: + +(define-module (8sync define-method-star) + #:use-module (oop goops) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-11) + #:export (define-method*)) + +(define-syntax define-method* + (lambda (x) + (syntax-case x () + ((_ (generic arg-spec ... . tail) body ...) + (let-values (((required-arg-specs other-arg-specs) + (break (compose keyword? syntax->datum) + #'(arg-spec ...)))) + #`(define-method (generic #,@required-arg-specs . rest) + (apply (lambda* (#,@other-arg-specs . tail) + body ...) + rest))))))) diff --git a/dzn/local.mk b/dzn/local.mk index a6cef16408..99d84ae105 100644 --- a/dzn/local.mk +++ b/dzn/local.mk @@ -29,6 +29,7 @@ dist_%C%_scm_DATA = \ %D%/code.scm \ %D%/code-util.scm \ %D%/command-line.scm \ + %D%/define-method-star.scm \ %D%/display.scm \ %D%/explore.scm \ %D%/goops.scm \ -- Jan Nieuwenhuizen <jann...@gnu.org> | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
-- Janneke Nieuwenhuizen <jann...@gnu.org> | GNU LilyPond https://LilyPond.org Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com