From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.devel,gmane.lisp.guile.user Subject: Prevent inlining Date: Wed, 12 Feb 2020 18:44:31 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000ff7b14059e64862d" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="72285"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-devel , Guile User Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Wed Feb 12 18:45:00 2020 Return-path: Envelope-to: guile-devel@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 1j1w4J-000Iew-Uq for guile-devel@m.gmane-mx.org; Wed, 12 Feb 2020 18:44:59 +0100 Original-Received: from localhost ([::1]:41224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1w4I-0005VV-Vu for guile-devel@m.gmane-mx.org; Wed, 12 Feb 2020 12:44:59 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45553) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1w45-0005VD-5J for guile-devel@gnu.org; Wed, 12 Feb 2020 12:44:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j1w43-00072f-W3 for guile-devel@gnu.org; Wed, 12 Feb 2020 12:44:45 -0500 Original-Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:35245) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j1w43-00072C-Nk; Wed, 12 Feb 2020 12:44:43 -0500 Original-Received: by mail-wr1-x42b.google.com with SMTP id w12so3464956wrt.2; Wed, 12 Feb 2020 09:44:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=Lge0OS2jHN3qNmLa33eGm4WMC9b7Q4oIYImpMeMf3Ac=; b=gXoagzgxQK/V3SyEp3jAB2uVUSRfcVefA4IiN69+1y8WrT3wpBDONvTOnCEl0Y1Vgg MDCC6mVNz0S8nSFp6wQCl0P6+Kr5svlAilTiN6CucdmJRDT4mvFxrUKf4L9KQcmE0yd6 Ezo8bx+OGq5X548DTVN7CF/FYq7cWDimK9l93tq4vHk0i16tqLbsw0mVGXVzz478cOY/ 6geFEjsPtRipNepihoymxKMYHRh1D5itXiWkr88GG1Y+UYE1v5zINzl0EPFd+5IR3/Yr pju+XNHJBJ35cWeY+vlddzCyCnGOdq1Yn/LkWRJJQjU3V7e3h1zwU2jizuo0WQ/oMoag ckgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Lge0OS2jHN3qNmLa33eGm4WMC9b7Q4oIYImpMeMf3Ac=; b=BY1NNLR7uXvo9VTNfn4VhktK5CbNK2aMn/0JQfbIOecOPYZn0BHg/V2Fvs2VMKpto8 rLo7GVvY2P9TEUH4K/HD5qIUqCsPYH8nruU996ke8P/HQxUcfJ6ZqbP795RyNl3UskKT 1GT/xomZU0BksH/xnCAjU+T/K1RXYRFGZtkUfwy8JlAvidlNoMo0R6kJsCgo7PU2bl4W 4xS85T4/3bjMx0tkdf8/eWOJKIhtlAuaIJipvxeaMcxGAdPYTUrKKkTtcbvRLQ/IWKWQ FCbhwfPTe/U/6t7gkGq3lf7DvuYuz9jtKYkru35VisO0ym9Twy0Mk8oF1BcNLHp/o+ZE qj1g== X-Gm-Message-State: APjAAAWiGYVyiiF0+59SchTFF3tiuj0MpAWH8QO88UdCu8MU9KTaZTPt u/efhixtOtW3MRam3ru7nbnAcasHlkF8zCBgq/3zUZ74 X-Google-Smtp-Source: APXvYqxDh6YsG/1DWSttL+ngXdIpGq+t0cfd1+4SdU69DZ7NBGYhrFO+2oLqzFkHbrT6NMcQTMYLYlhQ8Js0Kdtkr38= X-Received: by 2002:adf:ecd0:: with SMTP id s16mr15971795wro.325.1581529482352; Wed, 12 Feb 2020 09:44:42 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42b X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20409 gmane.lisp.guile.user:16165 Archived-At: --000000000000ff7b14059e64862d Content-Type: text/plain; charset="UTF-8" Hi all, Current guile inlines even variables exposed in the module interface, and I understand that we must live with that and code around it. So here is a few tips how to mitigate it. The simplest way is to put this definition in a module: ------------------------ (define-module (syntax not-inline) #:export (not-inline)) (cond-expand (guile-3.0 (define (not-inline x) x)) ((or (guile-2.0 guile-2.2) (define-syntax-rule (not-inline x) x))) ------------------------------------- And then in another module do, (use-modules (syntax not-inline)) (define variable (not-inline 12)) (define function (not-inline (lambda () ...))) etc This is also an option (not perfect but you get the gist) ----------------------------------------------------------------- (define-module (syntax define-not-inlinable) #:use-module (syntax not-inline) #:export (inline define lambda define* lambda* define-values) (define inline (lambda (x) x)) (define-syntax define (syntax-rules (inline) ((define (f . x) . code) (define f (not-inline (lambda x . code))) ((define f (inline x)) (define f x)) ((define f x) (define f (not-inlinable x)))) ---------------------------------------------------------------------------------- using this module will make all usual define not inlineable and to enable inlining you would explicitly ask for it like (define f (inline (lambda (x) (+ x 10)))) If there is a need for this I can write the modules and expose it on the intertubes. WDYT /Stefan --000000000000ff7b14059e64862d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi all,

Current guile inlines even vari= ables exposed in the module interface, and I understand that we must live w= ith that and code around it. So here is a few tips how to mitigate=C2=A0it.=

The=C2=A0simplest=C2=A0way is to put this definit= ion in a module:
------------------------
(define-modul= e (syntax not-inline)
=C2=A0 #:export (not-inline))

(cond-expand
=C2=A0 (guile-3.0
=C2=A0 = =C2=A0 =C2=A0(define (not-inline x) x))
=C2=A0 ((or (guile-2.0 gu= ile-2.2)
=C2=A0 =C2=A0 =C2=A0(define-syntax-rule (not-inline x) x= )))

-------------------------------------
And then in another module do,

(use-modules (syn= tax not-inline))
(define variable (not-inline 12))
(def= ine function (not-inline (lambda () ...)))
etc

=
This is also an option (not perfect but you get the gist)
<= div>
--------------------------------------------------------= ---------
(define-module (syntax define-not-inlinable)
= =C2=A0 =C2=A0#:use-module (syntax not-inline)
=C2=A0 =C2=A0#:expo= rt (inline define lambda=C2=A0 define* lambda* define-values)
(de= fine inline (lambda (x) x))
(define-syntax define
=C2= =A0 =C2=A0(syntax-rules (inline)
=C2=A0 =C2=A0 =C2=A0 ((define (f= . x) . code)
=C2=A0 =C2=A0 =C2=A0 =C2=A0(define f (not-inline (l= ambda x . code)))
=C2=A0 =C2=A0 =C2=A0 ((define f (inline x))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(define f x))
=C2=A0 =C2=A0 =C2= =A0 ((define f x)
=C2=A0 =C2=A0 =C2=A0 =C2=A0(define f (not-inlin= able x))))
------------------------------------------------------= ----------------------------
using this module will make all usua= l define not inlineable and to enable inlining you would
explicit= ly ask for it like

(define f (inline (lambda (x) (= + x 10))))

If there is a need for this I can write= the modules and expose it on the intertubes.

WDYT=

/Stefan


<= /div>
=C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0


--000000000000ff7b14059e64862d--