Is it possible to convert string or int to bytes? #436
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
https://docs.aeternity.com/aesophia/v7.0.1/sophia_stdlib/#bytes
I've found functions to convert bytes to int and string, but I can't find the reverse. Probably it is because int and string have dynamic size, but still. As a workaround, I've used strings to concatenate binary data.
Created by: hanssv
No, it is not currently possible.
Originally strings used to be just "byte-arrays" but then it was important that they were interpreted as UTF8 (and thus not all byte-arrays are valid strings) - so we lost the generic byte arrays.
I'm curious if it would be possible to make compiler only changes that introduces arbitrary sized byte arrays. If time permits that might be something to look into.
Created by: hanssv
To follow up, it is only possible to do a little bit without changing FATE - I'll see if I can make a suggestion for Ceres instead...
Created by: hanssv
See #456