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

Simplification of setconfig! methods #1

Closed
wants to merge 1 commit into from

Conversation

tisztamo
Copy link

@tisztamo tisztamo commented Sep 2, 2020

Eliminated some code duplication. vscode also removed a few trailing spaces.

@citkane
Copy link
Owner

citkane commented Oct 1, 2020

Just looking at this now @tisztamo , sorry for the delay. I have my head down building a Julia Websocket library. Comments to follow on your pull request. Generally, thanks for pointing out the messy code factoring!

end
function setconfig!(path::String, value::Array)
value = json(value) |> JSON.parse
function setconfig!(path::String, value)
value = pathtodict(path, value)
Copy link
Owner

Choose a reason for hiding this comment

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

I have pathtodict as configpathtodict in utils.jl. Have you changes there not in this PR?

Copy link
Owner

Choose a reason for hiding this comment

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

Actually....
I think that your fork is behind my master, I am seeing that pathtodict is also in the replaced lines.

I am happy with all your proposals if your PR is aligned with the latest master. Just to verify some Julia priorities:

setconfig!(path::String, value::String)
setconfig!(path::String, value)
function setconfig!(path::String, value::Union{Tuple, AbstractArray, NamedTuple, Dict})

Is Julia going to prioritise functions with declared types, or is there meaning in the line ordering of function declarations?

Other than that, if you would bump the patch version and add yourself as a contributer, I will merge the request.

setconfig!(value)
end
function setconfig!(path::String, value::Dict)
function setconfig!(path::String, value::Union{Tuple, AbstractArray, NamedTuple, Dict})
value = json(value) |> JSON.parse
value = pathtodict(path, value)
Copy link
Owner

Choose a reason for hiding this comment

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

ditto

@tisztamo
Copy link
Author

tisztamo commented Oct 1, 2020

As this is now in the code I close it.

To your question "Is Julia going to prioritise functions with declared types, or is there meaning in the line ordering of function declarations?":

The first one. Julia selects the most specific method, ordering is not considered. No type annotation means Any.

Would be great to hear about your websocket library when it gets usable! I am currently working with HTTP.jl but not very happy with it.

@tisztamo tisztamo closed this Oct 1, 2020
@citkane
Copy link
Owner

citkane commented Oct 1, 2020

@tisztamo https://github.com/citkane/Websocket.jl - All done, just busy with documentation before I publish it to JuliaHub.

I am happy that HTTP.jl is there, it is a big effort, but I had to work around loads of issues to get my Websockets working with it...

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.

None yet

2 participants