strawman proposal for base4 and base 32 integer literals

kdex kdex at kdex.de
Mon Oct 8 07:34:16 UTC 2018


Sorry, but I highly doubt that it's worth reserving syntax for two bases for 
which even the author suggests their lesser usefulness.

This is best kept in user-space. Base-4 numbers should already be covered by 
this[1] proposal.

As for base 32, Carsten has already pointed out the problem of non-unique 
encodings (and this is true for every radix greater than 10).

If (your specific encoding of) base-32 literals were to be implemented in 
user-space, I think we could get away with extensible string literals, i.e. 
something akin to:

```js
const base32 = string => { /* …  */ };
console.log("10"_base32); // logs 32
```

[1] https://github.com/tc39/proposal-extended-numeric-literals

On Monday, October 8, 2018 2:51:04 AM CEST Shaun Moss wrote:
> Hi all
> 
> I'm new to the list so please forgive me if I breach etiquette.
> 
> I have drafted a proposal for addition to the ES spec:
> https://github.com/mossy2100/ecmascript/blob/master/base4and32literals.md
> 
> If anyone has a few spare minutes, I'd be grateful if you could please give
> it a quick look over. I'd really appreciate any feedback on how to improve
> or advance it. I haven't looked into implementation details yet but I will
> soon.
> 
> Thank you
> Shaun
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20181008/bd29d4a0/attachment.sig>


More information about the es-discuss mailing list