Skip to content

Conversation

@evacchi
Copy link
Collaborator

@evacchi evacchi commented Oct 22, 2024

Follow up to #527

Hopefully last big rename (related to this, at least) before the RC 😅

After chatting with @andreaTP, we agreed that ExternalValues, from the perspective of an end user, was confusing naming ("external to what?"). We came up with ImportedValues.

To be honest, my original objection with HostImports was about them being Host, not `Imports" :)

  • In all our usages, these values are indeed used by an instance.
  • They represent a named value assigned to an import (i.e. a named pair <module,name>).
  • The name is generic, it does not imply that value belongs to a Host-thing, nor a Wasm-thing, thus it can be used in both cases.
  • There is a specular opposite, at least for functions (ExportFunction)

we do "lose" the parallel with the spec, but this is less of an issue, because we only use these ImportValues as, duh, values imported by Instances. We never return ImportValue from an export*()-kind API, so everything should work

Order of Parameters for External/HostFunction

In this PR I am also changing, again, the order of the parameters for ImportFunction because the old constructor "broke" the signature into two pieces, i.e. the handle was between the names and the types:

  • module, name, handle, paramTypes, returnTypes

vs:

  • module, name, paramTypes, returnTypes, handle

which I think is clearer. This change is in the last 2 commits, for easier review.

Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
@evacchi evacchi changed the title Externalvalues importvalues Rename ExternalValues to ImportValues; order of params in ImportFunction,HostFunction. Oct 22, 2024
@evacchi evacchi marked this pull request as ready for review October 22, 2024 09:21
@evacchi evacchi requested a review from andreaTP October 22, 2024 09:21
@evacchi evacchi mentioned this pull request Oct 22, 2024
3 tasks
Copy link
Collaborator

@andreaTP andreaTP left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

@andreaTP andreaTP merged commit 87ecca5 into dylibso:main Oct 22, 2024
13 checks passed
@evacchi evacchi deleted the externalvalues-importvalues branch October 22, 2024 15:09
evacchi added a commit that referenced this pull request Oct 23, 2024
Reworded a few sections, this will need changes if #589 gets merged.
Notably:

- The `HostFunction` section now comes first, so I removed the reference
to "using _again_ memory" because this is the first time we are seeing
it
- I have also rounded up the section to introduce and clarify the
concept of "host", "guest"
- [x] the description of the `HostFunction` should change to reflect
#589
- [x] we should also update this same section to use the `Store` from
the start
- [x] we might describe later the alternate method (passing in
"imports"/"external values" directly) for low-level access

EDIT: I did all the last 3 above as #589 was merged in the meantime

---------

Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
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.

2 participants