4 ms·
Octal is a great way to mislead both human beings and software, and I kind of hope it gets removed by browsers as a result of this new attention. It’s one of th
by floatingatoll 5y ago
Octal is a great way to mislead both human beings and software, and I kind of hope it gets removed by browsers as a result of this new attention. It’s one of those things that isn’t productive or useful in any way in our modern era and serves only to complicate with no benefit in return.
- broodbucket 5y agoProbably useless in the browser, but who uses octal in general? I assume it's still important in some areas (networking?) but I don't actually know. Only thing I can think of personally is UNIX file permissions.
- floatingatoll 5y agoI would refuse any PR that used octal unnecessarily, and I generally ask people to use chmod plus-addressing rather than octal where possible, so that there’s a lower risk of math errors and a higher chance of good review. 0644|0755: a=rX,u+w 0600: u=rw Etc.
- broodbucket 5y agoThis is funny for me to read because I converted a bunch of constants for file permissions to octal values in the Linux kernel because they're harder to read and there's multiple ways of arriving at the same value. You wanna look up what a constant is and you find #define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH) or you could see 0444 and immediately know what it means. I agree in cases where you're modifying existing permissions it's much better to do a `chmod u+w` than to replace the whole thing with octal. When you're defining permissions at the time of creation though, everyone can parse 0644 at a glance. a=rX,u+w isn't so bad but I don't know if I'd prefer it personally, in code where you can't use chmod syntax I'm definitely preferring octal.
- floatingatoll 5y agoHow do you represent a=rX in octal?
- broodbucket 5y agoOh, I didn't know what X did and made assumptions. If you split file permissions into two halves - defining the initial permissions / modifying something that already exists - I can see how it makes sense to do both with the same syntax since modifying existing permissions is worse with octal.
- Aardwolf 5y agoOctal as a base is fine, but that misleading notation where starting with a 0 means octal is not.