From: Per Bothner <per@bothner.com>
To: Panicz Maciej Godek <godek.maciek@gmail.com>, kawa@sourceware.org
Subject: Re: Type information seems to be erased in macros
Date: Wed, 29 Dec 2021 15:30:09 -0800 [thread overview]
Message-ID: <010e9c97-43ad-475e-576b-1f69a140d219@bothner.com> (raw)
In-Reply-To: <CAMFYt2YrXxPx84adKFH+ig=ZJN2rSKUaEhmLrAMS6R+NM3MmGQ@mail.gmail.com>
On 12/29/21 14:12, Panicz Maciej Godek via Kawa wrote:
> Does the macro system erase type information from objects?
Not in general, but it is possible that a compond name
like screen:translate! might not survive the macro-expansion process.
The --debug-print-expr flag may be useful to see what is happening.
It prints out the syntax tree after name lookup and macro-expansion,
but before type analysts and optimizations.
It you post a short self-contained program I can take a look.
There is a good chance you might have better luck with:
(invoke screen 'translate! x! y!)
That should avoid any issues with compound symbols.
> If I add explicit casts in the macro, is it likely to cause some
> performance penalty?
Almost certainly nothing you'd notice: Probably just an extra checkcast
instruction in the bytecode. Which means some extra work, but pretty minor.
If end up needing run-time reflection (which is what you get if
you ignore the warning), that is a lot more expensive.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
next prev parent reply other threads:[~2021-12-29 23:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-29 22:12 Panicz Maciej Godek
2021-12-29 23:30 ` Per Bothner [this message]
2021-12-30 8:52 ` Panicz Maciej Godek
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=010e9c97-43ad-475e-576b-1f69a140d219@bothner.com \
--to=per@bothner.com \
--cc=godek.maciek@gmail.com \
--cc=kawa@sourceware.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).