Clojure

*out* being used as java.io.PrintWriter

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: Release 1.3
  • Component/s: None
  • Labels:
    None
  • Approval:
    Ok

Description

There seem to be several places in clojure/contrib where out is being used as a java.io.PrintWriter, despite being documented as of type java.io.Writer
Examples are:

  • The reflection warnings from the compiler
  • Exception printouts from contrib.sql

This causes very confusing errors, when out isn't actually a PrintWriter, for example in a swank repl where it is a StringWriter.

I've created a patch for the reflection warnings, but can't submit it here because of political issues.

Activity

Hide
Assembla Importer added a comment -

stu said: Updating tickets (#182, #286)

Show
Assembla Importer added a comment - stu said: Updating tickets (#182, #286)
Hide
Assembla Importer added a comment -

stu said: Second patch subsumes first, plus two additions

  • applies the same fix to the new pst function
  • improves usability of pst. pst's defaulting for the single-arity case was the opposite of what I expected, and the resulting error message is spectacularly confusing. Since the defaulting could trivially be extended to meet my expectations (pass an exception) without breaking the existing (pass a depth), I made it support both.

I don't like binding out to err, but the entire print plumbing drives you in this direction.

Show
Assembla Importer added a comment - stu said: Second patch subsumes first, plus two additions
  • applies the same fix to the new pst function
  • improves usability of pst. pst's defaulting for the single-arity case was the opposite of what I expected, and the resulting error message is spectacularly confusing. Since the defaulting could trivially be extended to meet my expectations (pass an exception) without breaking the existing (pass a depth), I made it support both.
I don't like binding out to err, but the entire print plumbing drives you in this direction.
Hide
Assembla Importer added a comment -
Show
Assembla Importer added a comment - stu said: [file:b4nAPA16Gr34ZzeJe5cbLA]
Hide
Assembla Importer added a comment -

djpowell said: There was also some discussion that out should not be assumed to be a PrintWriter:

http://groups.google.co.uk/group/clojure-dev/browse_thread/thread/99aa2b3263a0b374?hl=en

I've attached a patch for the related issue of err being assumed to be a PrintWriter. I think this is the only place in clojure itself, although there are other places in contrib.

Show
Assembla Importer added a comment - djpowell said: There was also some discussion that out should not be assumed to be a PrintWriter: http://groups.google.co.uk/group/clojure-dev/browse_thread/thread/99aa2b3263a0b374?hl=en I've attached a patch for the related issue of err being assumed to be a PrintWriter. I think this is the only place in clojure itself, although there are other places in contrib.
Hide
Assembla Importer added a comment -

djpowell said: [file:cEQbXEuiar367beJe5d-aX]: Fix for related printwriter issue

Show
Assembla Importer added a comment - djpowell said: [file:cEQbXEuiar367beJe5d-aX]: Fix for related printwriter issue
Hide
Assembla Importer added a comment -

rnewman said: See

https://www.assembla.com/spaces/clojure-contrib/tickets/55-clojure-contrib-sql-expects-*err*-to-be-a-printwriter

and the associated discussion on the group.

Clojure's out is actually intended to be a PrintWriter; it's a documentation issue.

Show
Assembla Importer added a comment - rnewman said: See https://www.assembla.com/spaces/clojure-contrib/tickets/55-clojure-contrib-sql-expects-*err*-to-be-a-printwriter and the associated discussion on the group. Clojure's out is actually intended to be a PrintWriter; it's a documentation issue.

People

  • Assignee:
    Unassigned
    Reporter:
    Anonymous
Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: