You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 28, 2019. It is now read-only.
Right now *out* and *err* are required to be Writer instances, and *out* is further assumed by much of clojure/core.clj to be a PrintWriter but there is no internal support for ensuring this. Maybe it'd be appropriate for *out* and *err* to be anonymous extensions of the Var class which provide the PrintWriter contract by wrapping the dereference operation.
Maybe it makes sense to put bind/deref functions on Vars. A bind validator fn would allow *out* and *err* to validate that they are always bound to a Writer instance no matter what users may do, and a deref transform fn would allow RT/getErrPrintWriter to get rolled up into *err*.deref().
The text was updated successfully, but these errors were encountered:
Really this is more along the line of symbol macros than value contracts. Dynamically scoped vars are one thing, but to really have a value contract you need a pluggable accessor function.
Maybe one answer is that *out* and *err* should be private and that there should be functions for getting the out and error streams, but that's gonna get in the way of output binding like what CIDER does. Not that I have a particular problem with breaking the 90% case which is people who abuse *out* as a convenient place to stash a file handle they can print to.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Right now
*out*
and*err*
are required to beWriter
instances, and*out*
is further assumed by much ofclojure/core.clj
to be aPrintWriter
but there is no internal support for ensuring this. Maybe it'd be appropriate for*out*
and*err*
to be anonymous extensions of theVar
class which provide thePrintWriter
contract by wrapping the dereference operation.Maybe it makes sense to put bind/deref functions on Vars. A bind validator fn would allow
*out*
and*err*
to validate that they are always bound to aWriter
instance no matter what users may do, and a deref transform fn would allowRT/getErrPrintWriter
to get rolled up into*err*.deref()
.The text was updated successfully, but these errors were encountered: