-
-
Notifications
You must be signed in to change notification settings - Fork 9
Implement representer #15
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
Conversation
|
Next steps:
|
|
@tehsphinx In the issue and on Slack there was a preference to have human readable "cleaned up code" as representation instead of some AST serialization. It sounds like you decided otherwise, can you share your reasoning? Here is a link to the Slack discussion: https://exercism-team.slack.com/archives/CAQP7JL3T/p1635175129080800?thread_ts=1635171130.077500&cid=CAQP7JL3T |
…re test cases; use native AST
|
Hi @junedev. Didn't see your comment but have come to the same conclusion. I wasn't happy with how hard to read, complicated and also large the representations where. I remembered how easy it would be to turn AST back into Go code after e.g. replacing names and removing comments. That's why I rewrote the whole thing again. It now parses the AST (drops comments right away), iterates it to replace the names and converts the AST back to Go code. That also removes any differences in whitespace or different formatting, which is nice. I think these steps are next for me:
|
|
If you have a moment (or anyone else), can you look at the example outputs in the |
|
(This is exciting!) |
|
@iHiD Is it possible to get a larger set of example solutions for some exercises in Go so we can check how many distinct representations our representer would produce and potentially identify additional things that need to be normalized? |
|
@tehsphinx I looked through the representations and they looked good to me at first glance but I don't have experience with representers. One thing that came to mind was whether we need to normalize things like |
|
@tehsphinx Awesome work, thanks for taking on this task! The representations seem to be exactly what we want, so it looks great. June talked about the different representations variables can have and whether the representation should be the same. Looking at the examples, I'm wondering the same thing and if things like I also briefly reviewed the code and it looks good, I found it very easy to follow. Since I'm not well versed in AST black magic, I didn't review that part in detail yet, but everything made sense looking at a glance. I understand this might not be totally finished yet, but I approved the changes to signal how much I like this PR. This is a solid first iteration. |
ErikSchierboom
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Lots of really nice tests too.
I'd also argue that they should be separate representations. Now for some concepts in some exercises, you could argue that you don't want to comment on this in a representation. In that case, you could perhaps build a system where certain transformations are only applied to certain exercises. |
|
@ErikSchierboom Thanks for the feedback! |
|
Thanks for the feedback, everyone! ❤️ From my side we can merge this and then open separate MRs for further iterations, or I can continue to work on this MR, whatever you prefer. About different variable definition, incrementing a variable, etc: If you agree, I'd go on checking on how to generalize these things:
(In a new branch/MR if you decide to merge this one) What do think? |
|
@tehsphinx Feel free to merge. I will follow up with the discussion in the issue. |
Features
Representation
Mapping