-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Feature js in smell #312
base: master
Are you sure you want to change the base?
Feature js in smell #312
Conversation
@julian-berbel this is just a draft but if you give me your feedback I can finish it without disturbing |
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.
Also just wondering, shouldn't this be an expectation? aren't there correct uses of for in out there?
gem/lib/mulang/language.rb
Outdated
@@ -63,14 +63,24 @@ def initialize(&tool) | |||
end | |||
|
|||
def ast(content, **args) | |||
@tool.call(content) rescue nil | |||
if args[:serialization] |
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.
I'm not sure I get this bit. If serialization is set to true, tool won't be called? what does that mean for extensions like mulang-ruby which use this for parsing?
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.
Perhaps it is a bit tricky, but yes, it will be called: super
calls ast_analysis
, which calls base_analysis
, which finally calls sample
, which polymorphically in this class class call_tool
.
I think it is ok but just because I am changing implementation semantics here, so that the main source of truth of the ast generation is in call_tool
, not in ast
anymore. As a consequence, both methods that require calling the ast generation tool - sample
and ast
- delegate on it.
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.
However I am not a fan of this implementation, how would you implement it?
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.
PS: this was not actually part of this original PR, I should have send as a separate one 🤣
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.
I see!
However I am not a fan of this implementation, how would you implement it?
If I'm understanding correctly you could just do super in either case (not overriding the method) then, right? but simply calling tool on second case is faster? I'm fine with that
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.
Yes, exactly. The original behavior was to always simply call tool. However, this is not good we when actually want serialization - or maybe some other future flags, like e.g. force_normalization
, so I added this case.
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.
PS: I have merged this as a separate PR #314
44624ec
to
04af03c
Compare
04af03c
to
f9ff61a
Compare
No description provided.