Hacker News new | past | comments | ask | show | jobs | submit login

This kind of non-obvious behavior seems like a dark side of Postel's Law.



0x1234 is hexadecimal. 1234 is decimal. 01234 is octal. 0b1011011101111 is binary. It's de-facto standard, especially in the UNIX world.


It's a standard that everyone knows because they have been bitten by it. :(

I was curious about it being limited to the UNIX world, and indeed, C# is the only C-like language that does not have this feature. On the UNIX side, even Go decided to keep them [0]. Python dropped them in v3 but I'm not sure if that counts as a UNIXy language or not...

[0] http://groups.google.com/group/golang-nuts/browse_thread/thr...


The new wave for octal notation is 0o1234; it's supported by haskell and some others and seems much cleaner to my tastes.


I was thinking more of the two dots instead of three. (Interestingly, RFC 791 does not define dotted-quad notation. It must have been added later.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: