public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* possible bug in free-identifier=?
@ 2024-05-20 17:02 Damien Mattei
  2024-05-20 23:50 ` Per Bothner
  0 siblings, 1 reply; 3+ messages in thread
From: Damien Mattei @ 2024-05-20 17:02 UTC (permalink / raw)
  To: kawa mailing list

[-- Attachment #1: Type: text/plain, Size: 801 bytes --]

hello,

i do not understand the behavior of free-identifier=? here:

Kawa 3.1.1 (git describe: 3.1.1-0-gc47de33ad)

(free-identifier=? #'sin #'sin)
java.lang.NullPointerException: Cannot invoke
"gnu.expr.Compilation.currentScope()" because "comp" is null
at kawa.lang.SyntaxForms.identifierEquals(SyntaxForms.java:118)
at kawa.lib.std_syntax.isFreeIdentifier$Eq(std_syntax.scm:303)
at atInteractiveLevel-3.run(tty:3)
at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:290)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:211)
at kawa.Shell.run(Shell.java:289)
at kawa.Shell.run(Shell.java:196)
at kawa.Shell.run(Shell.java:183)
at kawa.repl.processArgs(repl.java:724)
at kawa.repl.main(repl.java:830)

why is there an error as i pass syntax objects as arguments to
free-identifier=? ?

regards,

damien

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

* Re: possible bug in free-identifier=?
  2024-05-20 17:02 possible bug in free-identifier=? Damien Mattei
@ 2024-05-20 23:50 ` Per Bothner
  2024-05-21  5:41   ` Damien Mattei
  0 siblings, 1 reply; 3+ messages in thread
From: Per Bothner @ 2024-05-20 23:50 UTC (permalink / raw)
  To: Damien Mattei, kawa mailing list

On 5/20/24 10:02 AM, Damien Mattei via Kawa wrote:
> hello,
> 
> i do not understand the behavior of free-identifier=? here:
> 
> Kawa 3.1.1 (git describe: 3.1.1-0-gc47de33ad)
> 
> (free-identifier=? #'sin #'sin)
> java.lang.NullPointerException: Cannot invoke
> "gnu.expr.Compilation.currentScope()" because "comp" is null
> ...
> why is there an error as i pass syntax objects as arguments to
> free-identifier=? ?

Not sure. But it looks like free-identifier=? only works inside a
compilation context (such as when macro-expanding), but not during evaluation.

Not sure how to fix this - or if should be fixed. Syntax objects aren't
meant to be used during evaluation, except when evaluating a macro.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

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

* Re: possible bug in free-identifier=?
  2024-05-20 23:50 ` Per Bothner
@ 2024-05-21  5:41   ` Damien Mattei
  0 siblings, 0 replies; 3+ messages in thread
From: Damien Mattei @ 2024-05-21  5:41 UTC (permalink / raw)
  To: Per Bothner; +Cc: kawa mailing list

[-- Attachment #1: Type: text/plain, Size: 1252 bytes --]

ok in fact i did use it only for test, just at REPL ,when i will port my
code to Kawa i will know because i will use free-identifier=? in macro stx
(syntax parsing) at this time. Yes i hope to use for at least one procedure
even if the other are specific to Guile (SRFI 105 available but not in
other scheme implementation).
Damien

On Tue, May 21, 2024 at 1:50 AM Per Bothner <per@bothner.com> wrote:

> On 5/20/24 10:02 AM, Damien Mattei via Kawa wrote:
> > hello,
> >
> > i do not understand the behavior of free-identifier=? here:
> >
> > Kawa 3.1.1 (git describe: 3.1.1-0-gc47de33ad)
> >
> > (free-identifier=? #'sin #'sin)
> > java.lang.NullPointerException: Cannot invoke
> > "gnu.expr.Compilation.currentScope()" because "comp" is null
> > ...
> > why is there an error as i pass syntax objects as arguments to
> > free-identifier=? ?
>
> Not sure. But it looks like free-identifier=? only works inside a
> compilation context (such as when macro-expanding), but not during
> evaluation.
>
> Not sure how to fix this - or if should be fixed. Syntax objects aren't
> meant to be used during evaluation, except when evaluating a macro.
> --
>         --Per Bothner
> per@bothner.com   http://per.bothner.com/
>

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

end of thread, other threads:[~2024-05-21  5:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-20 17:02 possible bug in free-identifier=? Damien Mattei
2024-05-20 23:50 ` Per Bothner
2024-05-21  5:41   ` Damien Mattei

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