Skip to content

Conversation

@sd2k
Copy link
Owner

@sd2k sd2k commented Sep 30, 2025

Enough to get quite a complicated WIT file working.

Still no resources yet but soon hopefully!

@sd2k sd2k force-pushed the outlier-example branch 4 times, most recently from c44abd0 to 9eac815 Compare October 7, 2025 09:18
@sd2k sd2k force-pushed the sd2k/phated/instructions branch from a0e1184 to d0490ae Compare October 7, 2025 09:19
@sd2k sd2k force-pushed the outlier-example branch from 9eac815 to 6815cf4 Compare October 7, 2025 09:45
blaine-arcjet and others added 18 commits October 7, 2025 07:51
…rcjet#108)

Prior to this commit, the `writeString` function would return the
previous error (from the `realloc.Call` function) if the write failed,
which would be nil. This commit fixes that by returning a new error
instead.

It also fixes a typo in the comment on the function doc comment.

---------

Co-authored-by: Blaine <[email protected]>
…cjet#107)

Start the refactoring of codegen parts into the library, where it
can be tested and more easily changed.

It moves the `Bindings` struct into the library, and adds a new `Wasm`
struct responsible for generating code to embed or inline the
WebAssembly file.

As part of this, `GoIdentifier` has become an owned type, so it was
changed to hold strings instead of references. This doesn't really
affect performance since references were always passed to
`format!()` which would allocate a new string anyway.

---------

Co-authored-by: blaine-arcjet <[email protected]>
Refactor the import and factory generation code
to a more modular approach. There are now two steps:

1. The import analysis step, which analyzes the imports in the
   world and generates a list of interfaces and standalone types
   in an intermediate representation.
2. The import code generation step, which takes the intermediate
   representation plus the WIT functions, and generates the Go
   code for the imports.

The goal is to make the code more modular and easier to maintain
and test.

---------

Co-authored-by: Blaine <[email protected]>
Refactor the `Bindings` struct to export the `generate` method.
This change replaces the previous string-specific option handling with a
generic method using reflection to check for zero values. It supports
optional types beyond just strings by using `reflect.ValueOf().IsZero()`
to determine emptiness.
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.

3 participants