Skip to content

refactor(json): convert JsonEncode to idiomatic FFI#88

Merged
akonwi merged 1 commit intomainfrom
refactor/json-ffi-idiomatic
Apr 11, 2026
Merged

refactor(json): convert JsonEncode to idiomatic FFI#88
akonwi merged 1 commit intomainfrom
refactor/json-ffi-idiomatic

Conversation

@akonwi
Copy link
Copy Markdown
Owner

@akonwi akonwi commented Apr 11, 2026

Summary

Converts JsonEncode from raw FFI to idiomatic FFI.

Changes

Before:

func JsonEncode(args []*runtime.Object) *runtime.Object

After:

func JsonEncode(value any) (string, error)

Generated Wrapper

func _ffi_JsonEncode(args []*runtime.Object) *runtime.Object {
    arg0 := args[0].Raw()
    result, err := ffi.JsonEncode(arg0)
    if err != nil {
        return runtime.MakeErr(runtime.MakeStr(err.Error()))
    }
    return runtime.MakeOk(runtime.MakeStr(result))
}

Cleanup

  • Removed runtime import from json.go

Stats

  • Raw FFI: 10 → 9
  • Idiomatic FFI: 63 → 64

- Change signature from raw (args []*runtime.Object) to idiomatic (value any) (string, error)
- Remove runtime import from json.go
- Raw FFI count: 10 → 9
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ard-lang-dev Ready Ready Preview, Comment Apr 11, 2026 1:50pm

@akonwi akonwi merged commit 536e88c into main Apr 11, 2026
4 checks passed
@akonwi akonwi deleted the refactor/json-ffi-idiomatic branch April 11, 2026 14:45
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.

1 participant