Skip to content

Conversation

@flbulgarelli
Copy link
Member

No description provided.

@flbulgarelli
Copy link
Member Author

@julian-berbel this is just a draft but if you give me your feedback I can finish it without disturbing

Copy link
Member

@julian-berbel julian-berbel left a 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?


def ast(content, **args)
@tool.call(content) rescue nil
if args[:serialization]
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

@flbulgarelli flbulgarelli Jan 19, 2021

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?

Copy link
Member Author

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 🤣

Copy link
Member

@julian-berbel julian-berbel Jan 20, 2021

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

Copy link
Member Author

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.

Copy link
Member Author

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

@flbulgarelli flbulgarelli force-pushed the feature-js-in-smell branch 2 times, most recently from 44624ec to 04af03c Compare January 22, 2021 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants