You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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{collectasas_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.
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.
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
__collecttocollect. If someone wants these functions to have different names (rare), they can do: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
aswhen importing.