Skip to content

Conversation

@KtorZ
Copy link
Member

@KtorZ KtorZ commented Apr 21, 2025

New prelude function to conveniently upcast any serialisable type into Data in places where the compiler cannot do it implicitly.

See also: aiken-lang/prelude#11

Note

I fancied for a second introducing a new language syntax for this, like:

 type Foo {
     foo: Int
 }
 type Bar {
    bar: Int
 }

 test foo() {
   [~Foo(14), ~Bar(42)] != []
 }

But that felt a bit overkill on top of making the language more complex. The as_data function is already fully erase at build time, so it has the same effects anyway.

  -> new prelude function to conveniently upcast any serialisable type
     into `Data` in places where the compiler cannot do it implicitly.

Signed-off-by: KtorZ <[email protected]>
@KtorZ KtorZ changed the title Introduce as_data Introduce as_data in prelude Apr 21, 2025
@rvcas rvcas merged commit a655063 into main Apr 24, 2025
12 of 13 checks passed
@rvcas rvcas deleted the as_data branch April 24, 2025 01:36
@github-project-automation github-project-automation bot moved this to ✅ In Next Release in Project Tracking Apr 24, 2025
@KtorZ KtorZ moved this from ✅ In Next Release to 🚀 Released in Project Tracking Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🚀 Released

Development

Successfully merging this pull request may close these issues.

4 participants