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
Improve F# Interactive formatting of byte arrays #17071
Comments
We're unlikely to take it to standard library (FSharp.Core), it's too specific and opinionated. It belongs to some sort of helpers library/module, now the question if we want to ship something like it alongside the fsi? Fsi printing is extensible, so shouldn't be a problem to just have a DLL for it? |
Its not opinionated its just the standard format for hex bytes. Anything else would be opinionated and specific. If theres an option for binary formatted bytes then why not a hex format. |
Right, in hex editor, where you can render it by columns and synchronise cursor between them, so it's actually useful. In F# REPL I prefer to see closer to how it would've been defined, so I can copy easily and do something with it. Does any other REPL have this as standard output? |
What Im saying is viewing bytes in hex is not opinionated, its a very sensible and standard way of viewing bytes. In my emulator code I use this too:
etc, it would be extremely unnatural to use ints |
What I meant is that it can be confusing as standard view option in repl, but fine as a function/method, but we don't really have a standardised way of shipping such helpers with fsi. |
Indeed the above |
Could it be possible to do something like When you are e.g. debugging a byte array content, you would need something that is already there, not needing to trust a random intrnet site still has maybe a working part you have to plugin to your source code. |
String is a seq of characters and still the fsi output is not like |
Working with byte arrays in F# is hard, because you don't see the proper content as bytes, neither the text-string-presentation of it. Working with byte-arrays is common scenario that can relate to networks, files, etc.
Example byte array:
The current (non-standard string-presentation):
The standard way (used by Git, hex-editors, etc) would be rendering the array in more visual way:
(hex-line number, tab, 8 hex-bytes + space + 8 hex-bytes, tab, string representation):
The good news is that this can be done with fairly simple F#-function (open source, original thanks to Christian Steinert):
But this function should be part of F# itself as the byte array default presentation format.
The text was updated successfully, but these errors were encountered: