-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Purity of low level functions / performance #107
Comments
This is correct. However, you have not articulated the problem with this state of affairs. While pure functions are generally nice to have, IO output is inherently impure, and so I must confess I don't see any automatic issue with an IO-oriented function being impure.
A bunch of non-standard usage is involved in the test suite to simulate/produce certain conditions that are normally inferred on the running system. This makes it hard for me to see what sort of issue you're pointing to when you show something unusual/awkward in the test suite to do with system capabilities.
Just taking a glance at the PR, it looks like you've tried to directly switch out Crayons for StyledStrings, and use StyledStrings in the same way as Crayons was in UnicodePlots. I don't anticipate that going particularly well, since Crayons and StyledStrings have rather different approaches to styling. For instance, UnicodePlots currently handles 4-bit/8-bit/24-bit colour printing itself, but this is one of the problems that StyledStrings is designed to take care of. Trying to take this out of StyledString's hands is fighting against the design of the package, and so is expected to result in ugly code.
When it comes to simply printing out text wrapped with ANSI codes, you can't really beat So you can expect |
Some low level
StyledStrings
functions are not pure, they depend on global states e.g.Base.have_truecolor
, ...E.g.:
StyledStrings.jl/src/io.jl
Lines 116 to 120 in 8985a37
which induces annoying workarounds such as
StyledStrings.jl/test/runtests.jl
Lines 23 to 32 in 8985a37
This is currently blocking in my trial PR to transition from Crayons.jl to the
StyledsStrings
stdlib, for UnicodePlots.jl.Also, I'm not sure transitioning will lead to a performance statu quo or gain in terms of performance / allocations.
The text was updated successfully, but these errors were encountered: