Open mkhubaibumer opened 6 months ago
This is an issue in the name mangling.
The problem here is that if the file is named a-1
, then implicitly that means that the name of the main reactor is a-1
, which isn't a valid identifier. For any other reactor, our validator would catch this and forbid naming a reactor class with an invalid identifier, but that isn't what we do here.
As a result, the correct solution to this is non-obvious. I lean toward forbidding the use of file names with hyphens. The alternatives would involve ending the convention that reactor names are valid identifiers or the convention that the name of the main reactor is the file name. Either of these alternatives seem like they could have complicated, potentially backwards-incompatible consequences.
Why do we require that the main reactor has the same name as the LF file?
Why do we require that the main reactor has the same name as the LF file?
So that when the name is omitted, it is implied by the name of the file.
That makes sense if the reactor name is not given. But why do we require that the file name matches the reactor name if it is given? A simple solution to the problem would be to allow the user to specify a main reactor name that differs from the file name.
If LF source file is named with a hyphen(-) in the name, code compilation fails
save this snippet as
a-1.lf
Running this produces