Re: Proper way to write EDN file, after production bug

2018-03-30 Thread LaurentJ
I mean just print-dup and print-meta should be enough !

Le vendredi 30 mars 2018 14:31:04 UTC+2, LaurentJ a écrit :
>
> Yes we will set print-dup, print-meta, print-level and print-length to 
> have a properly formatted edn file.
>
> Le vendredi 30 mars 2018 05:55:50 UTC+2, Didier a écrit :
>>
>> Ya, I'd write a wrapping fn, like ->edn which internally binds everything 
>> to what it should be, maybe even declares some extra print defmethod if you 
>> need custom edn serialization, and returns the edn.
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Proper way to write EDN file, after production bug

2018-03-30 Thread LaurentJ
Yes we will set print-dup, print-meta, print-level and print-length to have 
a properly formatted edn file.

Le vendredi 30 mars 2018 05:55:50 UTC+2, Didier a écrit :
>
> Ya, I'd write a wrapping fn, like ->edn which internally binds everything 
> to what it should be, maybe even declares some extra print defmethod if you 
> need custom edn serialization, and returns the edn.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Proper way to write EDN file, after production bug

2018-03-29 Thread Didier
Ya, I'd write a wrapping fn, like ->edn which internally binds everything to 
what it should be, maybe even declares some extra print defmethod if you need 
custom edn serialization, and returns the edn.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Proper way to write EDN file, after production bug

2018-03-29 Thread LaurentJ
I guess we will do that and provide an helper function in an util namespace 
to write an EDN file safely :/

By the way does binding *print-dup* to true isn't enough to prevent any 
interaction of other options like : *print-length* *print-level* ?



Le jeudi 29 mars 2018 21:16:54 UTC+2, Rick Moynihan a écrit :
>
> I'd suggest wrapping the code that writes via prn to the file with a 
> dynamic binding:
>
> e.g. at a REPL:
>
> user=> (set! *print-length* 5)
> 5
> user=> (prn (range 10))
> (0 1 2 3 4 ...)
> nil
> user=> (binding [*print-length* nil] (prn (range 11)))
> (0 1 2 3 4 5 6 7 8 9 10)
> nil
> user=> (prn (range 10))
> (0 1 2 3 4 ...)
>
> If you don't know how this works (or differs to lexical binding via let) 
> you can read up on vars here:
>
> https://clojure.org/reference/vars
>
> Hope this helps!
>
> R.
>
> On 29 March 2018 at 15:57, LaurentJ  
> wrote:
>
>> Hello,
>>
>> A funny bug today, our pipeline was broken because of an EDN file with 
>> ellipsis in it.
>>
>> It appears that the file was generated from a Clojure env with 
>> *print-length* configured.
>> So as many have asked, do we have a better way to write EDN file other 
>> than using prn ?
>>
>> For the moment what is the best strategy to fix this issue and keep our 
>> coders happy with their local repl configuration ?
>>   - ask them to limit the scope of such configuration, in for example the 
>> lein repl profile ?
>>   - wrap prn calls with rebinding of any dynamic vars modifing the 
>> outpout ?
>>
>> Regards
>> Laurent
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> 
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Proper way to write EDN file, after production bug

2018-03-29 Thread Rick Moynihan
I'd suggest wrapping the code that writes via prn to the file with a
dynamic binding:

e.g. at a REPL:

user=> (set! *print-length* 5)
5
user=> (prn (range 10))
(0 1 2 3 4 ...)
nil
user=> (binding [*print-length* nil] (prn (range 11)))
(0 1 2 3 4 5 6 7 8 9 10)
nil
user=> (prn (range 10))
(0 1 2 3 4 ...)

If you don't know how this works (or differs to lexical binding via let)
you can read up on vars here:

https://clojure.org/reference/vars

Hope this helps!

R.

On 29 March 2018 at 15:57, LaurentJ  wrote:

> Hello,
>
> A funny bug today, our pipeline was broken because of an EDN file with
> ellipsis in it.
>
> It appears that the file was generated from a Clojure env with
> *print-length* configured.
> So as many have asked, do we have a better way to write EDN file other
> than using prn ?
>
> For the moment what is the best strategy to fix this issue and keep our
> coders happy with their local repl configuration ?
>   - ask them to limit the scope of such configuration, in for example the
> lein repl profile ?
>   - wrap prn calls with rebinding of any dynamic vars modifing the outpout
> ?
>
> Regards
> Laurent
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Proper way to write EDN file, after production bug

2018-03-29 Thread LaurentJ
Hello,

A funny bug today, our pipeline was broken because of an EDN file with 
ellipsis in it.

It appears that the file was generated from a Clojure env with 
*print-length* configured.
So as many have asked, do we have a better way to write EDN file other than 
using prn ?

For the moment what is the best strategy to fix this issue and keep our 
coders happy with their local repl configuration ?
  - ask them to limit the scope of such configuration, in for example the 
lein repl profile ?
  - wrap prn calls with rebinding of any dynamic vars modifing the outpout ?

Regards
Laurent

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.