Opened 11 years ago

Closed 11 years ago

#382 closed defect (fixed)

write-string / write-simple-string error

Reported by: rme Owned by: gb
Priority: minor Milestone:
Component: Compiler Version: trunk
Keywords: Cc:

Description

? (funcall #'(lambda () (write-string "foobar" t :end 2)))
> Error: value NIL is not of the expected type UNSIGNED-BYTE.
> While executing: (:INTERNAL BAD-SEQUENCE-INTERVAL CHECK-SEQUENCE-BOUNDS), in process listener(1).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.
1 > :b
 (6A5978) : 0 (FUNCALL #'#<(:INTERNAL BAD-SEQUENCE-INTERVAL CHECK-SEQUENCE-BOUNDS)> "foobar" NIL 2) 181
 (6A59A8) : 1 (FUNCALL #'#<#<STANDARD-KERNEL-METHOD STREAM-WRITE-STRING (BASIC-CHARACTER-OUTPUT-STREAM T)>> #<BASIC-CHARACTER-OUTPUT-STREAM ISO-8859-1 (TTY/1) #x300040EF978D> "foobar" NIL T) 669
 (6A5A40) : 2 (WRITE-SIMPLE-STRING "foobar" T NIL 2) 1637

We see that WRITE-SIMPLE-STRING is getting NIL as the START parameter.

I'm not sure if the problem here is with the compiler macro on WRITE-STRING, or with WRITE-SIMPLE-STRING.

We could change the compiler macro to provide a default value of 0 for the start keyword argument, or else we could change the WRITE-SIMPLE-STRING deal with a possibly NIL value for START in the case where the stream isn't a basic-stream, e.g., by writing (or start 0) in the call to STREAM-WRITE-STRING.

(I'd just go ahead and change the compiler macro, but i assume that WRITE-SIMPLE-STRING is a performance hack, and I don't want to mess that up.)

Change History (2)

comment:1 Changed 11 years ago by gb

I'd vote for changing the compiler-macro to do:

  ((lambda (string stream &key (start 0) end)

comment:2 Changed 11 years ago by rme

  • Resolution set to fixed
  • Status changed from new to closed

Changed the compiler macro in r11443.

Note: See TracTickets for help on using tickets.