Skip to content

Add hex int syntax - #1403

Open
mattisboeckle wants to merge 4 commits into
mainfrom
hex-long
Open

Add hex int syntax#1403
mattisboeckle wants to merge 4 commits into
mainfrom
hex-long

Conversation

@mattisboeckle

@mattisboeckle mattisboeckle commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Allows for literals with exactly eight digits in hexadecimal format for Integers.
Works alongside the already existing syntax for byte literals in hex format.

Example

val a = 0xff00ff00ff
val b = 0x00000000
...

@mattisboeckle
mattisboeckle marked this pull request as draft June 22, 2026 12:51
@mattisboeckle
mattisboeckle marked this pull request as ready for review June 22, 2026 14:01
@jiribenes

jiribenes commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

I was wondering if we could have a new Word primitive type that would:

  1. use 0wDEADBEEFCAFEBABE literals (saw that SML had those, I'm willing to bikeshed the syntax),
  2. be 64-bit unsigned on all platforms (this would likely include some JS shim, or "polyfill" as they call it -- either wrapping a pair of numbers or using bigint),
  3. supported only casts into/from existing numeric types, and
  4. all bitwise operations would need to be done on Words or Bytes, that is no more bitshifts on Ints.

This would be useful for both FFI and for more bit-twiddling, bitset-ey structures, etc. WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants