File tree Expand file tree Collapse file tree
component-model/src/design Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,12 +73,34 @@ The return type is a pair of 32-bit integers,
7373reflecting that the function must return
7474the new offset for the newly allocated string, as well as its length.
7575
76+ For this to work, the module defining the ` remove-duplicates ` function
77+ would also need to include
78+ an export declaration that exports a memory to be used
79+ for the argument and result strings. Pseudocode:
80+
81+ ```
82+ export "string_mem" (mem 1)
83+ ```
84+
85+ And, the module using the ` remove-duplicates ` function
86+ would need to import this memory. Pseudocode:
87+
88+ ```
89+ import "strings" "string_mem"
90+ ```
91+
92+ (This pseudocode is still simplified, since the importer
93+ also needs to declare the size of the memory being
94+ imported.)
95+
7696We would prefer to write a pseudocode type signature like this:
7797
7898```
7999remove-duplicates: func(s: string) -> string
80100```
81101
102+ and dispense with the memory exports and imports altogether.
103+
82104Data representations are frequently specific to each programming language.
83105For example, a string in C is represented entirely differently
84106from a string in Rust or in JavaScript.
You can’t perform that action at this time.
0 commit comments