Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Update SDK, fix now-not-silently-dropped fields - #26

Merged
juanjux merged 5 commits into
bblfsh:masterfrom
juanjux:update_sdk2
Feb 22, 2019
Merged

juanjux merged 5 commits into
bblfsh:masterfrom
juanjux:update_sdk2

Conversation

@juanjux

@juanjux juanjux commented Feb 21, 2019

Copy link
Copy Markdown
Contributor

Same as the Python and Ruby PRs.

Juanjo Alvarez added 2 commits February 20, 2019 12:07
Signed-off-by: Juanjo Alvarez <[email protected]>
Signed-off-by: Juanjo Alvarez <[email protected]>
Comment thread driver/normalizer/normalizer.go Outdated
"Name": Var("name"),
Fields{
{Name: "Name", Op: Var("name")},
{Name: "ExpandedFromMacro", Optional: "optMacro", Op: Any()},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see optMacro being used. Please add a comment on why it can be dropped.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not used because it's dropped :) It's there any other way to tag a field as optional without using the Optional field?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. I can add Drop: true to Fields.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was fast!

@bzz bzz Feb 22, 2019 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused - is something expected to be changed with this annotation regarding to latest SDK release with Drop: true?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least it could be, yes :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also after reading https://github.com/bblfsh/sdk/pull/369/files#diff-3bd9e60cee55dd92c09d4e11f0b3905bR754 still confused by intent of

tag a field as optional without using the Optional field

and the difference between Optional + Any() vs Drop (presumably +Any())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only difference is that it won't declare a state variable as Optional does:

Optional is implied, but the variable won't be created in this case.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so Optional = if there is X, you HAVE to use X in ... otherwise still match but do nothing where the Drop is more like a promise that we would never use or need it in a target tree?

Comment thread driver/normalizer/normalizer.go Resolved
Signed-off-by: Juanjo Alvarez <[email protected]>
Comment thread driver/normalizer/normalizer.go Resolved
Juanjo Alvarez added 2 commits February 22, 2019 17:33
Signed-off-by: Juanjo Alvarez <[email protected]>
Signed-off-by: Juanjo Alvarez <[email protected]>
@juanjux

juanjux commented Feb 22, 2019

Copy link
Copy Markdown
Contributor Author

@dennwc changed the many Any'es to use Drop+Any, PTAL.

@dennwc dennwc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@bzz bzz left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤙

But @dennwc @juanjux - please help me understand, is that our preferred strategy right now in driver updates?

Having hard times orienting myself in the tradoffs involved in choosing this approach over e.g adding Map(Part("_", Obj("field": Any(),)) in Preprocessor.

I wish we could have a meeting on this with @creachadair, or something and agree on way of mapping things 😕

@creachadair

Copy link
Copy Markdown
Contributor

Having hard times orienting myself in the tradoffs involved in choosing this approach over e.g adding Map(Part("_", Obj("field": Any(),)) in Preprocessor.

I wish we could have a meeting on this with @creachadair, or something and agree on way of mapping things 😕

I'm happy to schedule a meeting if you all would like to talk about it. I have no obviously-correct answer here, but would be glad to talk it out.

I don't think we need to block this PR for it, since it's a larger design question that we probably shouldn't address until we know what the goal is. :)

@juanjux
juanjux merged commit 4a35944 into bblfsh:master Feb 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants