wrap-cli icon indicating copy to clipboard operation
wrap-cli copied to clipboard

Handle reserved words in type and method names

Open krisbitney opened this issue 3 years ago • 0 comments

We should handle reserved words in type and method names. Doing so will require care, since our Array and Map type definitions don't currently distinguish between object and non-object types. For example, an Int32[] would contain items of type i32 in AssemblyScript. A naive implementation would prepend m_ to the type when generating the AssemblyScript code because "i32" is a reserved word.

Related: Issue https://github.com/polywrap/monorepo/issues/721, PR https://github.com/polywrap/monorepo/pull/780.

Update: we need to make sure the solution will work well for AssemblyScript, Rust, Go, and future languages.

A proposed solution is to prepend reserved words with _. This may be more aesthetically pleasing than prepending with m_.

krisbitney avatar May 06 '22 19:05 krisbitney