5 ms·
Cool idea! Clear and nicely organized too :) Wouldn’t it be more readable and less error-prone to have separate commands for turning hex mode on and off? Such
by edudobay 8y ago
Cool idea! Clear and nicely organized too :)
Wouldn’t it be more readable and less error-prone to have separate commands for turning hex mode on and off? Such as `hex on` and `hex off`?
- thosakwe 8y agoBelieve it or not, I didn't even consider that. That's definitely a better way to do it.
- ygra 8y agoWas the first thing that stood out to me as well. Toggled modes like this are also quite annoying when shuffling around sections of the file. Copy one hex too many and suddenly your numbers in another part are all wrong. And due to the toggle you'll have a hard time finding the place where it all went wrong. As far as I could tell it's been more or less the only mode. At that point I'd probably get rid of it because global state (which modes are) has to be remembered at all times and in this case its invisible until you see output. The suggestion to use different operators or modifiers for a single numbers was a good one in that direction IMO.
- akx 8y agoIn addition, global modes lead to hairy things like if ... hex off endif
- abtinf 8y agoI think it might be more intuitive as an explicit stream modifier: hex, decimal, etc. No reason to turn anything “off”, which is actually the activation of a diffferent mode. Edit: What I mean is hex 00 dec 00 utf8 00
- thosakwe 8y agoDefinitely, that's probably the best way, considering all the other commands are "stream-y" as-is.
- cryptonector 8y agoWhy have hex mode toggles at all? Just use 0xa1b2, and so on. 0x... -> hex, 0... -> octal -- invent a syntax for binary.
- skissane 8y agosyntax for binary: 0b11010011
- IshKebab 8y ago0 for octal was a huge mistake. Most sane languages use 0o now, or just forget octal. How often do you use octal anyway? Like, once a year for file permissions?
- cryptonector 8y agoOK, sure. As long as we don't have to toggle number bases...
- stevekemp 8y agoIt surprised me that an octal mode wasn't available, or a binary one. But that's a minor gripe. The only other thing I could see being useful is the ability to define "structs", for binary-headers, etc. But agreed, this is a neat tool.