rfc:explicit_octal_notation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
rfc:explicit_octal_notation [2020/10/21 14:59] – Change status girgiasrfc:explicit_octal_notation [2020/11/07 08:33] – Add explicit mention of upper case notation. girgias
Line 12: Line 12:
 This convention for octal integers is well established and followed by many programming languages (Java, C, C#, Golang, Haskell, and more). However, Python, JavaScript, and Rust [[https://docs.python.org/3/reference/lexical_analysis.html#integer-literals|[1]]][[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Numbers_and_dates|[2]]][[https://doc.rust-lang.org/rust-by-example/primitives/literals.html|[3]]] only accept or support an explicit octal notation ''0o''. This convention for octal integers is well established and followed by many programming languages (Java, C, C#, Golang, Haskell, and more). However, Python, JavaScript, and Rust [[https://docs.python.org/3/reference/lexical_analysis.html#integer-literals|[1]]][[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Numbers_and_dates|[2]]][[https://doc.rust-lang.org/rust-by-example/primitives/literals.html|[3]]] only accept or support an explicit octal notation ''0o''.
  
-Surprisingly PHP already has support for this notation and ''0O'' when using the <php>octdec()</php> and <php>base_convert()</php> functions.+Surprisingly PHP already has support for this notation when using the <php>octdec()</php> and <php>base_convert()</php> functions.
  
 ===== Proposal ===== ===== Proposal =====
  
-Add support for the explicit octal notation ''0o'' for integer literals analogous to ''0x'' and ''0b'' for hexadecimal and binary.+Add support for the explicit octal notation ''0o''/''0O'' for integer literals analogous to ''0x''/''0X'' and ''0b''/''0B'' for hexadecimal and binary.
  
 <code php> <code php>
 0o16 === 14; // true 0o16 === 14; // true
 0o123 === 83; // true 0o123 === 83; // true
 +
 +0O16 === 14; // true
 +0O123 === 83; // true
  
 016 === 0o16; // true 016 === 0o16; // true
 +016 === 0O16; // true
 </code> </code>
  
rfc/explicit_octal_notation.txt · Last modified: 2021/01/04 20:12 by girgias