[slime-devel] Windows connection coding system for Allegro and LispWorks

Paulo Madeira acelent at gmail.com
Sun Mar 11 23:32:17 UTC 2012


Hi.

A recent change where UTF-8 was made the network coding system didn't
take into account the end-on-line transformation that some
implementations do. A very disturbing proliferation of ^M infested the
REPL and the Inspector.

I'm sending a patch (in attachment) to make ACL and LW use a UTF-8
coding system that doesn't transform line endings, specifically to
CRLF in Windows. Please take a look at it.

I tested ACL 8.2 Express and LispWorks 6.0.1 Personal, and both seem
to be working fine. I evaluated some expressions in the REPL:

CL-USER> (princ "
")

"
"

I also compiled a file:

(cl:in-package #:cl-user)

(defun test-string ()
  (princ "
"))

Then, in the REPL:

CL-USER> (test-string)

"
"

I got the same result when compiling the defun/region separately.

The inspector now seems fine.

Out of curiosity, I tested in other implementations. The inspector
seems fine in all of them, so here are the REPL tests.


ABCL 1.0.1 jre7u3:

CL-USER> (princ "
")
^M
"
"
; Compiling C:/Users/Paulo/Lisp/string.lisp ...^M
; Wrote c:/Users/Paulo/Lisp/string.abcl (0.081 seconds)^M
CL-USER> (test-string)
^M
"
"
STYLE-WARNING: redefining TEST-STRING at top level^M
CL-USER> (test-string)
^M
"
"

ABCL has a specific ext:make-slime-output-stream. it instances a
SlimeOutputStream which inherits Stream's default definition of
eolStyle, which is platformEolStyle, hence it outputs CRLF's when
printing.

I think that the correction requires a change in ABCL, either by not
using the platform dependent eol-style, or by accepting an optional
external-format or eol-style so it can be overriden in the case of a
newer SLIME version of swank-abcl.lisp and to keep the old behaviour
in older versions.


CLisp 2.49:

CL-USER> (princ "
")

"
"
;; Compiling file C:\Users\Paulo\Lisp\string.lisp ...
;; Wrote file C:\Users\Paulo\Lisp\string.fas
0 errors, 0 warnings
;; Loading file C:\Users\Paulo\Lisp\string.fas ...
;; Loaded file C:\Users\Paulo\Lisp\string.fas
CL-USER> (test-string)

"
"
WARNING: DEFUN/DEFMACRO: redefining function TEST-STRING in top-level,
was defined in C:\Users\Paulo\Lisp\string.fas

CL-USER> (test-string)

"
"

Works just fine.


ClozureCL 1.7 x64:

CL-USER> (princ "
")

"
"
;Compiling "c:/Users/Paulo/Lisp/string.lisp"...
CL-USER> (test-string)
^M
"^M
"
 TEST-STRING
CL-USER> (test-string)

"
"

It reads the source file as-is, hence the ^M's appear only with the
compiled file test, but not with the compiled defun/region test. I
don't know if this is by design.


SBCL:

CL-USER> (princ "
")

"
"
; compiling file "c:/Users/Paulo/Lisp/string.lisp" (written 11 MAR
2012 10:22:55 PM):

; c:/Users/Paulo/Lisp/string.fasl written
; compilation finished in 0:00:00.017
CL-USER> (test-string)
^M
"^M
"
; compiling (DEFUN TEST-STRING ...)
STYLE-WARNING: redefining COMMON-LISP-USER::TEST-STRING in DEFUN

CL-USER> (test-string)

"
"

Same as ClozureCL.


Please excuse the long boring message and any formatting error in the
attached patch file.

Regards,

Paulo Madeira
-------------- next part --------------
A non-text attachment was scrubbed...
Name: slime.diff
Type: application/octet-stream
Size: 1589 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/slime-devel/attachments/20120311/3a00bf95/attachment.obj>


More information about the slime-devel mailing list