Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Converters\from] Needs sanitization #1914

Open
drkameleon opened this issue Feb 27, 2025 · 0 comments
Open

[Converters\from] Needs sanitization #1914

drkameleon opened this issue Feb 27, 2025 · 0 comments
Labels
cleanup Code cleanup, comments and micro-optimizations → Converters enhancement New feature or request open discussion Open discussion about features/ideas/suggestions

Comments

@drkameleon
Copy link
Collaborator

Top priority

.binary, .hex, .octal ➞ ❌ remove

Instead of:

value: from.binary "101010"
value: from.hex "FF00FF"

We could simply have:

value: to :integer .base:2 "101010"
value: to :integer .base:16 "FF00FF"

(with could use .binary, .hex, .octal too - although this would lead to unnecessary clutter for something that isn't even that common!)

Another idea would be using .format: which is already supported.

💡 Suggestion similar to that for Converters\as

Another idea comes directly from the suggestion above: once we have a parse, if we natively support normal hex/octal numbers (e.g. 0b10101, 0o1234567, 0x118371FAB)... we could actually be using the exact same function, like: parse "0b10101" which is even better 😉


For future reference

.opcode ➞ ❌ remove

This isn't bad, but I'm not sure how it fits right now:

  • if we had a built-in type for byte or opcode or sth like that, then this would happen in a natural way, by adding conversion support to to
  • another relatively practical idea would be to transfer this to an external package (even perhaps to ArtSembly?)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
cleanup Code cleanup, comments and micro-optimizations → Converters enhancement New feature or request open discussion Open discussion about features/ideas/suggestions
Projects
Development

No branches or pull requests

1 participant