# (Ab)use of IOContext for fine-grained output control

**URL:** <https://discourse.julialang.org/t/ab-use-of-iocontext-for-fine-grained-output-control/3509>\
**Category:** General Usage\
**Tags:** question\
**Created:** [May 4, 2017, 7:07am UTC](https://discourse.julialang.org/t/ab-use-of-iocontext-for-fine-grained-output-control/3509 "2017-05-04T07:07:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fengyang.wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fengyang.wang/32/104_2.png) [@fengyang.wang](https://discourse.julialang.org/u/fengyang.wang)\
**Post date:** [May 4, 2017, 7:07am UTC](https://discourse.julialang.org/t/ab-use-of-iocontext-for-fine-grained-output-control/3509/1 "2017-05-04T07:07:57Z")

</div>

Is it considered a reasonable use of `IOContext` to define a large number of settings that control output in a fine manner? I’m considering settings such as `:serialcomma => true`, `decimalpoint => "."`, and similar, and wonder if this is perhaps overloading the capacities of `IOContext`. If so, what would be a reasonable alternative to express this, while still tying into the Julia output system?

---

<div class="post-metadata">

**Author:** ![jameson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jameson/32/23_2.png) [@jameson](https://discourse.julialang.org/u/jameson)\
**Post date:** [May 8, 2017, 4:05pm UTC](https://discourse.julialang.org/t/ab-use-of-iocontext-for-fine-grained-output-control/3509/2 "2017-05-08T16:05:53Z")

</div>

I think the current recommendation here is that if you know exactly how your output should be formatted, it is more sensible to compose your own IO layout using `@printf` or Formatting.jl or similar to get exactly that output you intended, rather than trying to configure the output via the recursive IO argument.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [May 8, 2017, 6:18pm UTC](https://discourse.julialang.org/t/ab-use-of-iocontext-for-fine-grained-output-control/3509/3 "2017-05-08T18:18:26Z")

</div>

The issue with that is that you may call a formatting function which in turn calls … a function which prints a number, potentially with separators. How do you pass options to that inner formatting routine? Using the IOContext object seems like a not-completely-insane way to do it, but I haven’t thought it through.
