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
merged 5 commits into from
Feb 22, 2019

Conversation

juanjux
Copy link
Contributor

@juanjux juanjux commented Feb 21, 2019

Same as the Python and Ruby PRs.

Juanjo Alvarez added 2 commits February 20, 2019 12:07
Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
"Name": Var("name"),
Fields{
{Name: "Name", Op: Var("name")},
{Name: "ExpandedFromMacro", Optional: "optMacro", Op: Any()},
Copy link
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
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
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
Member

Choose a reason for hiding this comment

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

Copy link
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!

Copy link
Contributor

@bzz bzz Feb 22, 2019

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
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
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
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
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?

Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
Juanjo Alvarez added 2 commits February 22, 2019 17:33
Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
@juanjux
Copy link
Contributor Author

juanjux commented Feb 22, 2019

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

Copy link
Member

@dennwc dennwc left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@bzz bzz left a comment

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
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