public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* Type information seems to be erased in macros
@ 2021-12-29 22:12 Panicz Maciej Godek
  2021-12-29 23:30 ` Per Bothner
  0 siblings, 1 reply; 3+ messages in thread
From: Panicz Maciej Godek @ 2021-12-29 22:12 UTC (permalink / raw)
  To: kawa

Hi,
I have defined a macro:

(define-syntax-rule (with-translation screen (x y) . actions)
  (let ((x! x)
        (y! y))
    (screen:translate! x! y!)
    (let ((result (begin . actions)))
      (screen:translate! (- x!) (- y!))
      result)))

which (presumably) operates on Screen interface, which provides translate!
method.

I use it in a context which makes it clear that the type of the first
argument passed to with-translation is Screen:

(define (draw! object #!optional (screen::Screen (current-screen)))::Extent
  ...
  (with-translation screen (left top) ...)
  ...)

However, when I import (to the REPL) a module containing this code, I get
the following complaint near the use of the with-translation macro:

warning - no known slot 'translate!' in java.lang.Object

Does the macro system erase type information from objects?

If I add explicit casts in the macro, is it likely to cause some
performance penalty?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-30  8:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-29 22:12 Type information seems to be erased in macros Panicz Maciej Godek
2021-12-29 23:30 ` Per Bothner
2021-12-30  8:52   ` Panicz Maciej Godek

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).