Samarium
Samarium copied to clipboard
Call Overload Not Working as Expected
The following example, as presented in the documentation:
@ OutputStorage {
=> func * {
'func: func;
'outputs: [];
}
() args... * {
out: 'function(**args);
'outputs_: [out];
* out;
}
}
...
fails to compile with the error: [SyntaxError] cannot use an identifier after a literal.
However, the behavior varies in different cases:
-
The following example
() args * {}transpiles successfully, but the resulting Python script contains multiple sequential function signatures, which leads to a PythonSyntaxError:def ()(self, sm_args): ^ SyntaxError: invalid syntax -
Removing the arguments entirely:
() * {}, causes the transpiler to crash silently. The error can only be seen when manually compiling from Python:File ".../samarium/transpiler.py", line 426, in transpile self._process_token(index, token) File ".../samarium/transpiler.py", line 993, in _process_token func(self, token, push) File ".../samarium/transpiler.py", line 638, in _functions if self._line[indented + 1] == "=": ~~~~~~~~~~^^^^^^^^^^^^^^ IndexError: list index out of range
I really want to use the language.. When will the fix be available?