how should (newline) work?

10 views
Skip to first unread message

Stuart Halloway

unread,
Aug 20, 2010, 10:42:17 AM8/20/10
to cloju...@googlegroups.com
There are two possibilities on the table:

(1) Always print the result of  (System/getProperty "line.separator").

(2) Bind the result of  (System/getProperty "line.separator") to a new global, rebindable var that people can then change.

If you have an opinion please let us know, either here or on the ticket at https://www.assembla.com/spaces/clojure/tickets/300-newline-should-output-platform-specific-newline-sequence.

Thanks!

Stu

David Powell

unread,
Aug 20, 2010, 11:05:12 AM8/20/10
to cloju...@googlegroups.com

On Fri 20/08/10 16:42 , "Stuart Halloway" stuart....@gmail.com sent:


> There are two possibilities on the table:
> (1) Always print the result of (System/getProperty
> "line.separator").
> (2) Bind the result of (System/getProperty "line.separator") to a
> new global, rebindable var that people can then change.

I get the impression that println and friends are a only a fairly basic i/o mechanism, and it
isn't really necessary for them to be massively customisable.

There are some cases where people might want to write text other than in their platform-specific
line-ending, where a bindable var might be useful (eg HTTP and MIME recommend CRLF, other
protocols expect LF) but I suspect that people who need to do that would proabably not be using
println anyway because they would want more control over buffering and character encodings, and
the ability to write binary output to the stream.

So I think option 1 is probably good enough.

--
Dave

Sean Devlin

unread,
Aug 20, 2010, 11:08:34 AM8/20/10
to cloju...@googlegroups.com
I think respecting the platform's default is a good idea.  Rebinding system properties seems like trouble waiting to happen.

Sean

--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To post to this group, send email to cloju...@googlegroups.com.
To unsubscribe from this group, send email to clojure-dev...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/clojure-dev?hl=en.

Chas Emerick

unread,
Aug 20, 2010, 11:16:17 AM8/20/10
to cloju...@googlegroups.com
Absolutely (1).  People will rebind *linesep*, call out to some Java lib (which may or may not have a clojure façade), and suddenly the *linesep* binding is "broken".  Bleh.

At least, that's the rationale that I give to those hoping/looking for a *classpath* var.

- Chas

Reply all
Reply to author
Forward
0 new messages