effekt-lang / effekt-lang/effekt

Add a 'Word' (64 bits) primitive type

Open
#1,431 0 comments 0 reactions 0 assignees View on GitHub
feature requires-design
Dominant language
Scala
Stars
469
Forks
41
Avg merge
1d 16h
Merged PRs (30d)
23

Description

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 `number`s or using `bigint`),
3. supported only casts into/from existing numeric types, and
4. all bitwise operations would need to be done on `Word`s or `Byte`s, that is no more bitshifts on `Int`s.

This would be useful for both FFI _and_ for hashing, more bit-twiddling, bitset-ey structures, etc.

_Originally posted in https://github.com/effekt-lang/effekt/issues/1403#issuecomment-5208819571_

Contributor guide

No contributing guide indexed for this repository

Research direction

No files, tests, or entry points are named. Start by mapping where primitive types, literal syntax, numeric casts, and bitwise operations are defined, then resolve the literal and cross-platform representation choices before implementation; done means the proposed Word behavior is specified across all listed operations and platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, scala
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.