Description
Copied from #1559 (comment)
Description
I want to propose to use a better notation for the public assembly script functions. There is no need to prepend __
before the end of the functions.
Reasoning
Usually, __
is used before something that should not be used, not something that every developer needs to call manually. TypeScript provides many ways to prevent name conflicting that are better than prefixing underscores.
I would recommend renaming __collect
to collect
. If someone wants these functions to have different names (rare), they can do:
import { collect as as_collect } from '...'
Using __
and similar notations are used in languages like C that do not have any notion of namespace or module and the names conflict with each other. This is not certainly the case for AssemblyScript.
Example from other languages
Julia, the only language I know that allows triggering garbage collection manually, uses GC.gc() function for triggering garbage collection. GC is a module (namespace) and gc is the function name.
https://docs.julialang.org/en/v1/base/base/#Base.GC.gc
Potential Methods
-
There was one suggested by @MaxGraey here:
Rewrite runtime, switch to tracing GC and bootstrap #1559 (comment) -
If I was the one who makes the decision, I would just use the power of TypeScript namespaces and modules. In TypeScript it is already possible to rename the functions using
as
when importing.