Regarding the proposed Binray Literals Deprecation

Don Allen donaldcallen at gmail.com
Sun Sep 18 12:47:03 UTC 2022


On Sunday, 18 September 2022 at 04:26:45 UTC, Preetpal wrote:
> 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:
>>> [...]
>>
>> 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>
> ```

An extension offered by one compiler, off by default, is not the 
same as inclusion in the official language definition. The 
official Haskell language does not include binary literals.


More information about the Digitalmars-d mailing list