From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Maxim Cournoyer Newsgroups: gmane.lisp.guile.bugs Subject: bug#66046: Relative includes in R7RS define-library seem broken Date: Tue, 14 Nov 2023 08:57:48 -0500 Message-ID: <87il64cu8z.fsf@gmail.com> References: <6C8500AC-6352-4849-A2C9-2DFEB34F21D5@nonceword.org> <3jwzxtCW91bvW_AqM4x1Xpm-kdOmiBYvVFfKneO0-Ls556aEA5wWugMgOShhtaP0cpfvxta2wcuqZX3jSelpVE4QpmTo2zjX92QQ5owzp04=@hyper.dev> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31284"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: "66046@debbugs.gnu.org" <66046@debbugs.gnu.org> To: Amirouche Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Tue Nov 14 14:58:59 2023 Return-path: Envelope-to: guile-bugs@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 1r2twQ-0007wn-EM for guile-bugs@m.gmane-mx.org; Tue, 14 Nov 2023 14:58:58 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2tvq-00010y-75; Tue, 14 Nov 2023 08:58:22 -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 1r2tvo-00010V-Dq for bug-guile@gnu.org; Tue, 14 Nov 2023 08:58:20 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r2tvo-0007mr-5H for bug-guile@gnu.org; Tue, 14 Nov 2023 08:58:20 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r2twT-0005Gt-UK for bug-guile@gnu.org; Tue, 14 Nov 2023 08:59:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 14 Nov 2023 13:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66046 X-GNU-PR-Package: guile Original-Received: via spool by 66046-submit@debbugs.gnu.org id=B66046.169997032020223 (code B ref 66046); Tue, 14 Nov 2023 13:59:01 +0000 Original-Received: (at 66046) by debbugs.gnu.org; 14 Nov 2023 13:58:40 +0000 Original-Received: from localhost ([127.0.0.1]:60533 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2tw7-0005G6-VV for submit@debbugs.gnu.org; Tue, 14 Nov 2023 08:58:40 -0500 Original-Received: from mail-qv1-xf33.google.com ([2607:f8b0:4864:20::f33]:51318) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2tw6-0005Ft-EQ for 66046@debbugs.gnu.org; Tue, 14 Nov 2023 08:58:39 -0500 Original-Received: by mail-qv1-xf33.google.com with SMTP id 6a1803df08f44-6779fb43e5cso25357316d6.2 for <66046@debbugs.gnu.org>; Tue, 14 Nov 2023 05:57:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699970270; x=1700575070; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=+Oi6F3us8M2tPsMFMJ8E71lXz8R51YKiPI3Rey0Tfdo=; b=W5siV/DwW4W+tnnU7U/pHAPj+WEL/3v9E/HUOhZcMFbG5qXzoKgkzI2i6g21ixb64u xxH2a+1Q8ClCAqPzSlnTRrDjp2lNJvwlZmCUNRiRactsqY6Ao1n+w2BNZgWU1R+pTibR qGsSiL10mvNF4LbyLeBqUt289DKecn2ODcwCFcvXF9Gqd2wpXOMgitwPPKdCGSVS3+SC GlAWc41sKtya4iBX626C6V69r3EuhjL6fjkEYlEhr3yVw7fZF1OzxXv/o2xwZ4Uj8o6K 91V1oaUa0L0CqWX560MzRy9CbR4BvlyzEzrKZ8pP28iZZyda1W20Yp2ZENqRy0owAaGW 0EwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699970270; x=1700575070; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+Oi6F3us8M2tPsMFMJ8E71lXz8R51YKiPI3Rey0Tfdo=; b=jvb3e5NbclL2UEgG1/G2nPH06K2LN6HivkvTyu8eXxMmjajTUsNvS+Ca6NhhKPY5G8 crb3thFYyovkU/ZAiJRCoYPgrXoMe/g5EavFuEqevDoNyMhP9Hqe//bulvDdNXnVjBBJ DECK8ImBcV2/lgtgP9m1yNYs+KTjx6asv683KWOi5RrvesT7RH8NgNEoen3GsycNCN0i V6zlvAPNHJZi2W54cUuyCYtTAei0fqrhE70VMKf4+7phTcREX2gqSX6WUbTgViIEHOsF 0YHVrL2nL78ng41OO7/0WR9YGbeaY1+MS/05vN/l9Ya3L8FGA6/NJfc9w+DQK/2Ph2Bd iG4Q== X-Gm-Message-State: AOJu0YxAwC8pE9VmcvCkgXIg1BXcXtiWHEWI1lAZIgNGqAFvEvDzfizD mAFqSwKc8Gz4Hz+DsfBnmt1SguFXZaE= X-Google-Smtp-Source: AGHT+IHzAl652FbdD9Wmu4z68eDUsk3cA9Widq6jj0Y2nnss7hEPk2EKha2lijtTruu+Vxh2wBCipQ== X-Received: by 2002:a05:6214:5281:b0:66d:6586:f2b4 with SMTP id kj1-20020a056214528100b0066d6586f2b4mr3094351qvb.21.1699970270148; Tue, 14 Nov 2023 05:57:50 -0800 (PST) Original-Received: from hurd (dsl-10-129-23.b2b2c.ca. [72.10.129.23]) by smtp.gmail.com with ESMTPSA id z13-20020a0ce60d000000b0065afbb39b2dsm2929569qvm.47.2023.11.14.05.57.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 05:57:49 -0800 (PST) In-Reply-To: <3jwzxtCW91bvW_AqM4x1Xpm-kdOmiBYvVFfKneO0-Ls556aEA5wWugMgOShhtaP0cpfvxta2wcuqZX3jSelpVE4QpmTo2zjX92QQ5owzp04=@hyper.dev> (amirouche@hyper.dev's message of "Sat, 11 Nov 2023 11:58:49 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.bugs:10698 Archived-At: Hello, Amirouche writes: > If I am not mistaken, the patch is not backward compatible. > > The problem with the current patch is that it force the included file > to be next to the including file, there is no fallback mechanism. > The algorithm should be dynamic using an ordered list a priority to > the favorite behavior. > > The most relevant hunk is: > > --- a/module/ice-9/psyntax.scm > +++ b/module/ice-9/psyntax.scm > @@ -3260,15 +3260,20 @@ > (let ((syntax-dirname (lambda (stx) > (define src (syntax-source stx)) > (define filename (and src (assq-ref src 'filename))) > - (and (string? filename) > - (dirname filename))))) > + (define source-file-name > + (fluid-ref compilation-source-file-name)) > + (or (and source-file-name > + (dirname source-file-name)) > + (and (string? filename) > + (dirname filename)))))) > > Here the code says: the included file must be in (syntax-dirname). > It is preferable to have fallbacks, to be backward compatible. It also falls back to the existing behavior, which is of picking up the parent directory of the port's file name (that is, the parent directory of the source file using the 'include' syntax), per the 'or' above. Isn't that sufficient? > `syntax-dirname' must be `syntax-dirnames' to return candidate directories > sorted list with biggest priority coming first where to find included > files. I'm not sure what algorithm you are suggesting here; but it seems it'd be something new in Guile. Since the behavior of 'include' is not standardized, I'd prefer we change it only if there are interesting use cases not yet covered (can you think of a scenario? we could add a test for it). > Also, mind the use of the fluid and how it interact with parallel compilation. Fluids are thread safe, as far as I know, and files are compiled one at a time anyway, so I don't foresee any problem here, as you also noted in #scheme on Libera. -- Thanks, Maxim