Skip to content
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/#10 merge recursive #140

Merged
merged 6 commits into from
Oct 25, 2018

Conversation

3timeslazy
Copy link
Member

No description provided.

return merged.Clone(), nil
}

func merge(src, dst core.Value) core.Value {
Copy link
Member

Choose a reason for hiding this comment

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

If it's a private method and you use it for merging objects, why don't you define its arguments and the output as the*values.Object type?

Copy link
Member Author

Choose a reason for hiding this comment

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

because this function can take values of different types at runtime

Copy link
Member

@ziflex ziflex left a comment

Choose a reason for hiding this comment

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

Looks good! But it needs some changes :)

merged := values.NewObject()

for _, arg := range args {
merged = merge(merged, arg.(*values.Object)).(*values.Object)
Copy link
Member

Choose a reason for hiding this comment

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

Ok, do we really need to cast arg to *values.Object if merge accepts core.Value?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope :) My bad

@ziflex ziflex merged commit 8575863 into MontFerret:master Oct 25, 2018
@ziflex
Copy link
Member

ziflex commented Oct 25, 2018

Great! Thank you for your PR.

@3timeslazy 3timeslazy deleted the feature/#10_merge_recursive branch November 2, 2018 22:59
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.

2 participants