Exception on pprint-logical-block without 'out:' (patch incl.)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Exception on pprint-logical-block without 'out:' (patch incl.)

Sudarshan S Chawathe

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


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)
Reply | Threaded
Open this post in threaded view
|

Re: Exception on pprint-logical-block without 'out:' (patch incl.)

Per Bothner
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
[hidden email]   http://per.bothner.com/