From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Julian Graham Newsgroups: gmane.lisp.guile.devel Subject: empty syntax objects Date: Mon, 19 Oct 2009 22:44:36 -0400 Message-ID: <2bc5f8210910191944q260f8472nfe3f6d593fc396d7@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1256006699 11830 80.91.229.12 (20 Oct 2009 02:44:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 20 Oct 2009 02:44:59 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Oct 20 04:44:52 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N04iR-0008PJ-1D for guile-devel@m.gmane.org; Tue, 20 Oct 2009 04:44:51 +0200 Original-Received: from localhost ([127.0.0.1]:40480 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N04iQ-00044x-7n for guile-devel@m.gmane.org; Mon, 19 Oct 2009 22:44:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N04iK-00044r-3S for guile-devel@gnu.org; Mon, 19 Oct 2009 22:44:44 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N04iF-00044G-Lv for guile-devel@gnu.org; Mon, 19 Oct 2009 22:44:43 -0400 Original-Received: from [199.232.76.173] (port=45992 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N04iF-00044D-Gk for guile-devel@gnu.org; Mon, 19 Oct 2009 22:44:39 -0400 Original-Received: from mail-ew0-f206.google.com ([209.85.219.206]:64553) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N04iF-0007Hs-49 for guile-devel@gnu.org; Mon, 19 Oct 2009 22:44:39 -0400 Original-Received: by ewy2 with SMTP id 2so5696768ewy.31 for ; Mon, 19 Oct 2009 19:44:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=6bi67/pKUB3i/T+paHdo2kcdniTT1NKC4OzqUGNFf+Y=; b=MLCe9oJVoh3SS2/Gdmy11FZD2cjLVpXUfxaYmsGu4BWOo1tevhmftAk4yiDYFqHFnH hgqYFPPHF/8da6veGlyFIsZxkHvsPeYu3NWkH/NJDTRp9/Qz+gb6Sl80du8IxYSWhDXJ 6NaIM1Nz2hQLL6b8zR/cxGpjo2O28ELyysH7U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=GKyOCBQ0Bz61UbbvqkbqL1KIHwEhhTA8u09s3YtRrI8cr22a6nGY8a5Tcwgaru8JRh 3m175IlzIRu0OW5CVcW9v3lO89ZFSNraieWhFL1j5qwYJE5ufcjM9lbh4JElzc/RXGW8 5wbmkNBhnhir0i61eGTh08yslCNCazDvVo6Oo= Original-Received: by 10.210.32.28 with SMTP id f28mr479472ebf.25.1256006676722; Mon, 19 Oct 2009 19:44:36 -0700 (PDT) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:9531 Archived-At: Hi all, This is a weird one. It looks like there's a problem with performing certain operations on syntax objects that "wrap" the empty list -- I think because such syntax objects are themselves indistinguishable from the empty list. I'm still not sure I fully understand what's going on, but suffice it to say that if you have a syntax-case expression that looks like: (syntax-case x () ((foo . rest) (datum->syntax #'rest 'foo))) ...you get an error if `foo' is expanded without anything to bind to `rest': ;;; key wrong-type-arg, throw_args (#f "Wrong type argument in position ~A: ~S" (2 2) (2)) You can get the same error via the following code: (datum->syntax #'() 'foo) The initial error message didn't include any source information, so I connected to the process with gdb and dug around in psyntax-pp.scm until I located the following line (5459), which seems to be the culprit: (#{syntax-object-wrap\ 116}# (lambda (#{x\ 783}#) (vector-ref #{x\ 783}# 2))) What's the right thing to do here? Do you just have to be careful with what you do with pattern variables that might end up getting bound to no arguments? R6RS isn't totally clear on the topic, but, for what it's worth, the same code seems to work in MzScheme. Regards, Julian