From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aibo.runbox.com (aibo.runbox.com [91.220.196.211]) by sourceware.org (Postfix) with ESMTPS id 7F9E03898516 for ; Mon, 29 Jun 2020 21:50:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7F9E03898516 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=bothner.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=per@bothner.com Received: from [10.9.9.73] (helo=submission02.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1jq1fJ-0008JP-D3; Mon, 29 Jun 2020 23:50:13 +0200 Received: by submission02.runbox with esmtpsa [Authenticated alias (524175)] (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) id 1jq1f4-0004Ib-M9; Mon, 29 Jun 2020 23:49:59 +0200 Subject: Re: questions on libraries, pattern matching etc To: Duncan Mak Cc: kawa mailing list References: <04256eab-fe24-417b-9f0d-fc554c9add96@www.fastmail.com> From: Per Bothner Message-ID: <81eb9fce-930a-f2b7-52ce-12f8da4c0be4@bothner.com> Date: Mon, 29 Jun 2020 14:49:54 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: kawa@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Kawa mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2020 21:50:17 -0000 On 6/29/20 1:50 PM, Duncan Mak wrote: > Hello Per, > > About the syntax for a match macro, work on SRFI 200 (draft) just started: > > https://srfi.schemers.org/srfi-200/srfi-200.html I haven't read it in detail, but it looks like the proposed pattern syntax is more-or-less compatible with Kawa. (There are lots of SRFIs coming out, and I've given up trying to pay close attention, especially since may of them are philosophically incompatible with Kawa. For example, Kawa has a consistent and powerful "sequence" concept and I think it's a mistake to define a large library of procedures for every sequence type, as seems to be the direction of R7RS-large.) The key thing about patterns in Kawa is they are integrated in the standard syntax forms, rather than being a pure "add-on" library feature. For example, the "variable" defined in a LET form can be a pattern. Also, not that in Kawa patterns and type-specifiers are integrated: a PATTERN can be: PATTERN ::TYPE To extend the syntax of Kawa patterns (which is highly deirable, and could plausible be done in the style of SRFI-200) one would need to extend kawa/lang/BindDecls.java, primarily. Not completely trivial, but not impossible either :-) > What do you think about adopting the syntax for the Wright-Cartwright-Shinn matcher? > > I've been trying to use match.scm (and its variants) in Kawa and simple patterns kinda work, but I see that: > > - matching records > - matching quasiquotes > > These two parts don't seem to be working. > > For now, I've backed out of using match.scm due to the missing features, but it'd really be nice to have a match macro that comes with Kawa scheme, following one of the grammar listed in the SRFI. > > Going a different direction, this design for a CASE* macro is also interesting, https://github.com/axch/pattern-case/blob/master/pattern-matching.txt While I'm OK with adding verious SRFI libraries for cmpatibility, patterns in the core part of Kawa should follow (and extend) the design in: https://www.gnu.org/software/kawa/Variables-and-Patterns.html#meta-pattern https://www.gnu.org/software/kawa/Definitions.html https://www.gnu.org/software/kawa/Local-binding-constructs.html -- --Per Bothner per@bothner.com http://per.bothner.com/