From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Panicz Maciej Godek Newsgroups: gmane.lisp.guile.user Subject: Weird module behaviour Date: Thu, 25 Sep 2014 16:04:06 +0200 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1411653888 30469 80.91.229.3 (25 Sep 2014 14:04:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 25 Sep 2014 14:04:48 +0000 (UTC) To: "guile-user@gnu.org" Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Sep 25 16:04:44 2014 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XX9et-0001dv-5x for guile-user@m.gmane.org; Thu, 25 Sep 2014 16:04:35 +0200 Original-Received: from localhost ([::1]:40412 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XX9es-00084x-Q3 for guile-user@m.gmane.org; Thu, 25 Sep 2014 10:04:34 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XX9eh-00083z-C4 for guile-user@gnu.org; Thu, 25 Sep 2014 10:04:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XX9ec-0006A5-LM for guile-user@gnu.org; Thu, 25 Sep 2014 10:04:23 -0400 Original-Received: from mail-wi0-x234.google.com ([2a00:1450:400c:c05::234]:45802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XX9ec-00069N-7x for guile-user@gnu.org; Thu, 25 Sep 2014 10:04:18 -0400 Original-Received: by mail-wi0-f180.google.com with SMTP id q5so9519283wiv.13 for ; Thu, 25 Sep 2014 07:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=EoEnINDwjEQuL34T0XnTrM+VcWeIMmqS/06m2WnXFq8=; b=dhm4vHCw/tBjCUjaGiCNYweo5hpNreE6dYdtc9XHdIsuBWGY6QsUVoir4gEL/7m6TE YzOv1ozpgAv70AHfBDLgV0HCcAL9g4Rk8w1aIZ1/M4xhboPQbgkNfUNCAVrKgf9JvZ6k 64IWuGEJoRNfQZ55P914D5FZBr/QKC5Z6fBXdjNjjF1xYaaaIXJq4arii4LNEEinMxTl LJxeJoAlvT0p7LwlFqwjkpu0LcTh0r9fi8toDehkUA+toc1mtjL+iEHWrAyOjJHpF/1u 8Y0swPoV1gbuM6qJWF3UWWVjx8zmZrOFMz6tyRyTezLJWZQRdec2QBdZo2WXdcN/Wh6g Dpkw== X-Received: by 10.194.80.2 with SMTP id n2mr16255119wjx.29.1411653846992; Thu, 25 Sep 2014 07:04:06 -0700 (PDT) Original-Received: by 10.194.188.36 with HTTP; Thu, 25 Sep 2014 07:04:06 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::234 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:11550 Archived-At: Hi all, I'm trying to use Aleix Conchillo's guile-redis module for my project, and it revealed a surprising use-case. Namely, guile-redis consists of several modules that are put together in one meta-module, which looks more or less like this: (define-module (redis) #:use-module (redis main) #:use-module (redis commands connection) #:use-module (redis commands hashes) #:use-module (redis commands keys) ...) (define-syntax re-export-modules (syntax-rules () ((_ (mod ...) ...) (begin (module-use! (module-public-interface (current-module)) (resolve-interface '(mod ...))) ...)))) (re-export-modules (redis main) (redis commands connection) (redis commands hashes) (redis commands keys) ...) So basically the meta-module adds the interfaces of its child modules. This isn't particularly surprising, because another way of creating a meta-module would be to enumerat all bindings from its child modules, which is a lot of work that would create an opportunity for desynchronization. However, it turns out that the modules export some names that would interfere with another names used in my project. Therefore, I decided to use the dedicated feature for avoiding such conflicts -- namely, renaming. If I (use-modules (redis)), everything works perfectly fine. However, if I try to use #:select, e.g. (use-modules ((redis) #:select (redis-connect))), I get an error: "no binding `redis-connect` in module (redis)". Furthermore, when I try to use the #:renamer feature, like (use-modules ((redis) #:renamer (symbol-prefix-proc 'redis:))) then I get neither redis-connect nor redis:redis-connect exported. I am almost certain that this weird behaviour stems from the way the meta-module is built (although I don't know the module system implementation well enough to point to the exact reason). However, the questions are: - if "resolve-interface" and "module-use!" are documented in the manual, shouldn't they inter-operate with #:select and #:rename features of use-modules? - if the above are to be considered dirty hacks, then what would be the proper way of creating meta-modules (other than listing all the exported bindings explicitly)? - or am I getting something wrong? Best regards, M.