acton
acton copied to clipboard
Mangle variable names to avoid collisions / conflict with stdout / stderr
It seems there are some names that are best avoided as variable / argument names on a C-level:
- stdout / stderr seem to be reserved on platforms like Windows and in Musl libc
- ERROR appears to be some macro on Windows, our logging.ERROR constants conflicts
I think it's best to avoid these names.
Currently, we generate C code that uses argument names straight from Acton, so
actor blargh():
var stdout = b""
will fail to compile on Musl.
What to do? Mangle names? Maybe we just add some special cases for reserved names?
@nordlander WDYT?
@nordlander do you think we could add a list of reserved names and if we see such a name, we add some prefix to it to avoid the reserved name? We'd obviously have to look for the prefix as well so nothing collides with our prefixed name.