Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create initial Witty crate with primitive type definitions #880

Merged
merged 7 commits into from
Jul 6, 2023

Conversation

jvff
Copy link
Contributor

@jvff jvff commented Jul 5, 2023

Motivation

The goal is to implement a new crate that generates host side code to interact with Wasm guest modules through a WIT interface. The first step is to represent the fundamental WebAssembly and WIT primitive types.

Solution

Use a sub-set of the Rust types as the fundamental primitive types. There are actually two sub-sets: SimpleTypes and FlatTypes. A SimpleType is part of the set of fundamental types defined for WIT (through the Component Model). The set of FlatTypes is a sub-set of the set of SimpleTypes, and represent the types that are natively supported in a WebAssembly virtual machine.

The types are in separate modules because more functionality will be added to them later.

@jvff jvff added the enhancement New feature or request label Jul 5, 2023
@jvff jvff added this to the Devnet milestone Jul 5, 2023
@jvff jvff requested a review from ma2bd July 5, 2023 19:21
@jvff jvff self-assigned this Jul 5, 2023
Copy link
Contributor

@ma2bd ma2bd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Of course, now, we want to see how it's going to be consumed.

};
}

simple_type!(bool, 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

jvff added 7 commits July 6, 2023 12:12
Populate it with a manifest file, and some initial documentation.
Collect all fundamental primitive types defined by the Component Model.
Represent the primitive types that are natively supported by
WebAssembly.
Ensure all `SimpleType`s can be flattened into a `FlatType`.
Primitives that are natively supported by WebAssembly should not be
flattened into some other type.
Allow `SimpleType` implementations to be converted into their `FlatType`
representation.
Make it easy to construct simple types from their flattened
representations.
@jvff jvff merged commit 3d9eb77 into linera-io:main Jul 6, 2023
@jvff jvff deleted the witty-types branch July 6, 2023 12:47
@jvff jvff mentioned this pull request Jul 24, 2023
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants