Skip to content
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

Suggestions for Strings (even a bug?) #41

Open
PallHaraldsson opened this issue Oct 20, 2024 · 3 comments
Open

Suggestions for Strings (even a bug?) #41

PallHaraldsson opened this issue Oct 20, 2024 · 3 comments

Comments

@PallHaraldsson
Copy link

julia> s = "Páll"
"Páll"

julia> About.about(s)
5-codeunit String (mutable) (<: AbstractString <: Any), occupies 5B directly (referencing 13B in total)
 • Character set: Extended ASCII

 ┌╴'P'╶─┐┌╴'Ã'╶─┐┌╴'¡'╶─┐┌╴'l'╶─┐┌╴'l'╶─┐ 5 codepoints
 0101000011000011101000010110110001101100

Strings are immutable, so "String (mutable)" is misleading, even if implemented somehow by something mutable, maybe just special-case and override that output?

Aslo while 5B is correct, do you know where 13B comes from? I doubt it's even correct. The minimum (malloc) allocation in Julia is 16 bytes it seems, here seemingly 8-byte overhead added.

Also blue on black background isn't the best color. Hard to see for "5 "codepoints]" and also for "Extended ASCII", where does that come from? Not strictly wrong, but state UTF-8? Or "UTF-8 (extended ASCII)"? And ASCII/UTF-8 when that applies?

I know why this happens "┌╴'Ã'╶─┐┌╴'¡'╶─┐", a bit misleading... could show like:

┌───- 'á' -───┐

┌╴'Ã'╶─┐┌╴'¡'╶─┐

@tecosaur
Copy link
Owner

tecosaur commented Nov 14, 2024

Let's leave the ┌╴'Ã'╶─┐┌╴'¡'╶─┐ display issue for #29.

The "(mutable)" and "13B" parts you query come from this:

julia> s = "Páll"
"Páll"

julia> ismutable(s)
true

julia> Base.summarysize(s)
13

This actually understates the size of the String (your string will take up 24B IIRC), but that's an upstream problem.

Also blue on black background isn't the best color. Hard to see for "5 "codepoints]"

This sounds like a terminal theme issue.

"Extended ASCII", where does that come from?

The characters you use in s fall within the Extended ASCII set, note that I don't say encoding.

@PallHaraldsson
Copy link
Author

Also blue on black background isn't the best color. Hard to see for "5 "codepoints]"

This sounds like a terminal theme issue.

You mean it's different for you or that I could change with a theme?

I think I have default theme/terminal for Linux Mint, likely same as for Ubuntu. And blue is always bad on black, so I think you want to have good defaults.

@tecosaur
Copy link
Owner

You mean it's different for you or that I could change with a theme?

It's terminal theme-dependent, and I think a strong argument can be made that basic ANSI colours should all be easily legible.

And blue is always bad on black, so I think you want to have good defaults.

This depends entirely on the lightness ratio. For reference, here's what I experience on two of my computers:

image

and

image

I'd recommend setting terminal themes that have good contrast ratios across all main colours, and short of that you can customise the emphasis face 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants