-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is SourceBuilder deprecated ? What should it be instead ? #291
Comments
It is an extremly neat utility, basically building an in-memory model of the generated code, and then relying on this in-memory model to manage indentation, etc. The main issue is that it introduces an indirection between the ThingML model and the generated code, which IMHO makes compilers harder to maintain. We do not have plan to refactor the existing compilers using SourceBuilder. If you modify an existing compiler using SourceBuilder, well, I guess you should continue using it. So, unless you plan to implement a compiler for Python (where proper indentation is necessary in the generated code), I would advise against using SourceBuilder for new compilers. Instead look at Java or C compilers (basically just relying on StringBuilder). |
I think it's nice to have good indentation. We could perhaps run |
Yes, it is nice to have good indentation. But as you point out, there are ways of automatically indent the code as a post-processing step, through tools and in the IDEs. That is the way we should investigate, so that we can keep the compilers maintainable, with a straightforward mapping between the compilers and the generated code. I guess for Java, we could look into https://github.com/revelc/formatter-maven-plugin For C, there is also a bunch of tools. It is probably good to have those indentation tools inside the |
No description provided.
The text was updated successfully, but these errors were encountered: