Regarding the proposed Binray Literals Deprecation

Preetpal preetpal.sohal at gmail.com
Sun Sep 18 04:26:45 UTC 2022


On Sunday, 18 September 2022 at 01:55:35 UTC, Don Allen wrote:
> On Saturday, 17 September 2022 at 22:11:35 UTC, Preetpal wrote:
>> On Saturday, 17 September 2022 at 21:57:41 UTC, Preetpal wrote:
>>> [...]
>>
>> Also, [Emacs 
>> Lisp](https://www.gnu.org/software/emacs/manual/html_node/elisp/Integer-Basics.html), [Fortran](https://riptutorial.com/fortran/example/6321/literal-constants), [Go](https://go.dev/ref/spec#Integer_literals), [Haskell](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/binary_literals.html), [OCaml](https://v2.ocaml.org/manual/lex.html#sss:integer-literals) and [Rust](https://doc.rust-lang.org/rust-by-example/primitives/literals.html). It's hard to find a language without this feature (every single language that came to mind had it).
>
> Haskell does *not* have binary integer literals. See the 2010 
> language report and
>
> ````
> Prelude> 0x10
> 16
> Prelude> 0o10
> 8
> Prelude> 0b10
>
> <interactive>:8:2: error: Variable not in scope: b10
> ````

"The language extension BinaryLiterals adds support for 
expressing integer literals". So you need to use a language 
extension to use it.

```
ps at DESKTOP:~$ ghci
GHCi, version 8.8.4: https://www.haskell.org/ghc/  :? for help
Prelude> :set -XBinaryLiterals
Prelude> 0b0010
2
Prelude>
```


More information about the Digitalmars-d mailing list