# Generalized Base Syntax upto 36 or 64

**URL:** <https://internals.rust-lang.org/t/generalized-base-syntax-upto-36-or-64/21777>\
**Category:** language design\
**Created:** [October 27, 2024, 7:58am UTC](https://internals.rust-lang.org/t/generalized-base-syntax-upto-36-or-64/21777 "2024-10-27T07:58:01Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![Finn](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/finn/32/3841_2.png) [@Finn](https://internals.rust-lang.org/u/Finn)\
**Post date:** [October 28, 2024, 10:37pm UTC](https://internals.rust-lang.org/t/generalized-base-syntax-upto-36-or-64/21777/21 "2024-10-28T22:37:10Z")

</div>

Let's add `ヰ!`, as outlined below, to libcore and call it a day.

> **details**
>
> ```rust
> const fn digit_value(digit: u8) -> u32 {
> digit as u32 - if digit.is_ascii_alphabetic() {
> 'a' as u32 - 10
> } else {
> '0' as u32
> }
> }
> 
> const fn roman_digit(digit: u8) -> u32 {
> match digit {
> b'I' => 1, b'V' => 5, b'X' => 10, b'L' => 50, b'C' => 100,
> b'D' => 500, b'M' => 1000, _ => panic!()
> }
> }
> 
> const fn u32_from_roman(a: &[u8]) -> u32 {
> let mut i = 0;
> let mut acc = 0;
> while i < a.len() {
> let value = roman_digit(a[i]);
> if i + 1 < a.len() {
> let next = roman_digit(a[i + 1]);
> if value < next {
> acc += next - value;
> i += 1;
> } else {
> acc += value;
> }
> } else {
> acc += value;
> }
> i += 1;
> }
> acc
> }
> 
> const fn u32_from_str(digits: &str) -> u32 {
> let a = digits.as_bytes();
> if b'A' <= a[0] && a[0] < b'a' {return u32_from_roman(a);}
> let mut acc = 0;
> let mut i = 1;
> let base = digit_value(a[0]);
> while i < a.len() {
> if a[i] != b'_' {acc = base*acc + digit_value(a[i]);}
> i += 1;
> }
> acc
> }
> 
> macro_rules! ヰ {
> ($digits:expr) => {
> const {u32_from_str(stringify!($digits))}
> }
> }
> 
> ```

```rust
assert_eq!([255; 3], [ヰ!(gff), ヰ!(211111111), ヰ!(CCLV)]);

```

---

<div class="post-metadata">

**Author:** ![jjpe](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/jjpe/32/9779_2.png) [@jjpe](https://internals.rust-lang.org/u/jjpe)\
**Post date:** [October 28, 2024, 10:55pm UTC](https://internals.rust-lang.org/t/generalized-base-syntax-upto-36-or-64/21777/22 "2024-10-28T22:55:14Z")

</div>

I seriously hope your comment is an attempt at humor, because nothing about that is practical.

**Checks calendar to see if it's April 1** hmm nope it's not that.

I'm starting to believe it would be best to just lock this thread.

---

<div class="post-metadata">

**Author:** ![Quercus](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/quercus/32/12702_2.png) [@Quercus](https://internals.rust-lang.org/u/Quercus)\
**Post date:** [October 29, 2024, 12:47am UTC](https://internals.rust-lang.org/t/generalized-base-syntax-upto-36-or-64/21777/23 "2024-10-29T00:47:36Z")

</div>

> [@Finn](#):
>
> Let's add `ヰ!` ...

> [@jjpe](#):
>
> I seriously hope your comment is an attempt at humor ...

This seems likely to me a case of delicately balanced deadpan humor, said with a tone of utter seriousness, plus just a little hint of its having been offered in jest. But as is often the case with such humor, only the author of the comment knows its intent with absolute certainty. 😃

---

<div class="post-metadata">

**Author:** ![Quercus](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/quercus/32/12702_2.png) [@Quercus](https://internals.rust-lang.org/u/Quercus)\
**Post date:** [October 29, 2024, 1:51pm UTC](https://internals.rust-lang.org/t/generalized-base-syntax-upto-36-or-64/21777/24 "2024-10-29T13:51:50Z")

</div>

Getting back the the actual topic of this discussion ...

> [@Dwarsloeper](#):
>
> Generalized Base Syntax upto 36 or 64

... with a Rust newcomer question ...

Hypothetically, if a feature such as this one, as an example, were to be formally proposed for inclusion in the Rust language, would the standard protocol be to send it to the [Rust Team](https://prev.rust-lang.org/en-US/team.html) for consideration, and if so, how would the process proceed, briefly explained?

---

<div class="post-metadata">

**Author:** ![jer](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/jer/32/1009_2.png) [@jer](https://internals.rust-lang.org/u/jer)\
**Post date:** [October 29, 2024, 3:33pm UTC](https://internals.rust-lang.org/t/generalized-base-syntax-upto-36-or-64/21777/25 "2024-10-29T15:33:20Z")

</div>

Rust uses an RFC process, see it fully documented here: [GitHub - rust-lang/rfcs: RFCs for changes to Rust](https://github.com/rust-lang/rfcs/)

---

<div class="post-metadata">

**Author:** ![Quercus](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/quercus/32/12702_2.png) [@Quercus](https://internals.rust-lang.org/u/Quercus)\
**Post date:** [October 29, 2024, 10:12pm UTC](https://internals.rust-lang.org/t/generalized-base-syntax-upto-36-or-64/21777/26 "2024-10-29T22:12:16Z")

</div>

> [@jer](#):
>
> Rust uses an RFC process ...

Thanks for that information.

Note that the OP has initiated this discussion: [RFC: Extending Beyond Base 36 for Free or Cheaper](https://internals.rust-lang.org/t/rfc-extending-beyond-base-36-for-free-or-cheaper/21784).

---

<div class="post-metadata">

**Author:** ![jjpe](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/jjpe/32/9779_2.png) [@jjpe](https://internals.rust-lang.org/u/jjpe)\
**Post date:** [October 31, 2024, 9:04am UTC](https://internals.rust-lang.org/t/generalized-base-syntax-upto-36-or-64/21777/27 "2024-10-31T09:04:05Z")

</div>

> [@Quercus](#):
>
> This seems likely to me a case of delicately balanced deadpan humor

The problem with that on text-based forum is the same as with sarcasm: the verbal and body language cues that mark a comment as such are just completely absent. What remains is little more than ambiguity.

---

<div class="post-metadata">

**Author:** ![Quercus](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/quercus/32/12702_2.png) [@Quercus](https://internals.rust-lang.org/u/Quercus)\
**Post date:** [October 31, 2024, 10:07am UTC](https://internals.rust-lang.org/t/generalized-base-syntax-upto-36-or-64/21777/28 "2024-10-31T10:07:02Z")

</div>

> [@jjpe](#):
>
> ... ambiguity.

You're right, it does have us speculating at this very moment ...

We'll not be updating our keyboards with the ヰ character just yet. `:-)`.

---

<div class="post-metadata">

**Author:** ![steffahn](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/steffahn/32/13288_2.png) [@steffahn](https://internals.rust-lang.org/u/steffahn)\
**Post date:** [April 24, 2026, 10:07am UTC](https://internals.rust-lang.org/t/generalized-base-syntax-upto-36-or-64/21777/29 "2026-04-24T10:07:23Z")

</div>

This topic was automatically closed 540 days after the last reply. New replies are no longer allowed.

[Previous page](https://internals.rust-lang.org/t/generalized-base-syntax-upto-36-or-64/21777.md?page=1)
