From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
To: guile-devel <guile-devel@gnu.org>, Guile User <guile-user@gnu.org>
Subject: Prevent inlining
Date: Wed, 12 Feb 2020 18:44:31 +0100 [thread overview]
Message-ID: <CAGua6m3DpZDPpKWd18wNjBJVbK22XeZ55Rt2k9g3SajkW5SSOA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1538 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 2227 bytes --]
next reply other threads:[~2020-02-12 17:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-12 17:44 Stefan Israelsson Tampe [this message]
2020-02-12 21:49 ` Prevent inlining Linus Björnstam
2020-02-13 7:36 ` Stefan Israelsson Tampe
2020-02-13 13:38 ` Linus Björnstam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAGua6m3DpZDPpKWd18wNjBJVbK22XeZ55Rt2k9g3SajkW5SSOA@mail.gmail.com \
--to=stefan.itampe@gmail.com \
--cc=guile-devel@gnu.org \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).