public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* Exception on pprint-logical-block without 'out:' (patch incl.)
@ 2017-06-11 22:37 Sudarshan S Chawathe
  2017-06-14  0:56 ` Per Bothner
  0 siblings, 1 reply; 2+ messages in thread
From: Sudarshan S Chawathe @ 2017-06-11 22:37 UTC (permalink / raw)
  To: kawa

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


Evaluating a pprint-logical-block form without the optional 'out'
keyword argument throws an exception.  (See details below.)  It works
fine when that is provided.

Based on a quick look at kawa/lib/kawa/pprint.scm, I suspect the
problem is just a missing (define out-expr #!null) in the
define-syntax-case.  The attached trivial patch seems to do the trick,
but I have not tested carefully.  (I can also submit using gitlab if
you prefer.)

Details:

chaw@vereq:~$ kawa
#|kawa:1|# (import (kawa pprint))
#|kawa:2|# (pprint-logical-block (display 'ok))
/dev/stdin:2:1: evaluating syntax transformer 'pprint-logical-block' threw kawa/pprint.scm:69:30: unbound location: out-expr
    gnu.mapping.DynamicLocation.get(DynamicLocation.java:36)
    kawa.lib.kawa.pprint.lambda1(pprint.scm:69)
    kawa.lib.kawa.pprint.lambda1$check(pprint.scm:10000)
    gnu.mapping.CallContext.runUntilValue(CallContext.java:667)
    gnu.mapping.Procedure.apply1(Procedure.java:148)
    kawa.lang.Macro.expand(Macro.java:205)
    kawa.lang.Macro.scanForm(Macro.java:235)
    kawa.lang.Translator.scanForm(Translator.java:1621)
    gnu.kawa.lispexpr.LispLanguage.parse(LispLanguage.java:117)
    gnu.expr.Language.parse(Language.java:764)
    gnu.expr.Language.parse(Language.java:758)
    kawa.Shell.run(Shell.java:266)
    kawa.Shell.run(Shell.java:196)
    kawa.Shell.run(Shell.java:183)
    kawa.repl.processArgs(repl.java:714)
    kawa.repl.main(repl.java:820)
#|kawa:3|# (pprint-logical-block out: (current-output-port) (display 'ok))
ok
#|kawa:4|# 
chaw@vereq:~$ kawa --version
Kawa 2.93 (git describe: 2.93-23-g4fa24f2-dirty)
Copyright (C) 2017 Per Bothner
chaw@vereq:~$ java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-1~bpo8+1-b11)
OpenJDK Server VM (build 25.131-b11, mixed mode)
chaw@vereq:~$ uname -a
Linux vereq.eip10.org 3.16.0-4-686-pae #1 SMP Debian 3.16.43-2 (2017-04-30) i686 GNU/Linux
chaw@vereq:~$ 


Regards,

-chaw


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: kawa-pprint-out.patch --]
[-- Type: text/x-diff, Size: 406 bytes --]

diff --git a/kawa/lib/kawa/pprint.scm b/kawa/lib/kawa/pprint.scm
index 2da844c..d402051 100644
--- a/kawa/lib/kawa/pprint.scm
+++ b/kawa/lib/kawa/pprint.scm
@@ -38,6 +38,7 @@
      (define per-line-prefix-expr #!null)
      (define suffix-expr #!null)
      (define port-expr #!null)
+     (define out-expr #!null)
      (let loop ((rest #'body))
        (syntax-case rest ()
          ((prefix: sexp . r)

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

* Re: Exception on pprint-logical-block without 'out:' (patch incl.)
  2017-06-11 22:37 Exception on pprint-logical-block without 'out:' (patch incl.) Sudarshan S Chawathe
@ 2017-06-14  0:56 ` Per Bothner
  0 siblings, 0 replies; 2+ messages in thread
From: Per Bothner @ 2017-06-14  0:56 UTC (permalink / raw)
  To: Sudarshan S Chawathe, kawa

On 06/11/2017 03:37 PM, Sudarshan S Chawathe wrote:
> 
> Evaluating a pprint-logical-block form without the optional 'out'
> keyword argument throws an exception.  (See details below.)  It works
> fine when that is provided.
> 
> Based on a quick look at kawa/lib/kawa/pprint.scm, I suspect the
> problem is just a missing (define out-expr #!null) in the
> define-syntax-case.  The attached trivial patch seems to do the trick,
> but I have not tested carefully.  (I can also submit using gitlab if
> you prefer.)

I checked this in. Thanks!
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

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

end of thread, other threads:[~2017-06-14  0:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-11 22:37 Exception on pprint-logical-block without 'out:' (patch incl.) Sudarshan S Chawathe
2017-06-14  0:56 ` Per Bothner

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