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

getipaddrs: make loopback (Bool) a keyword argument #31594

Merged
merged 1 commit into from
Apr 5, 2019

Conversation

StefanKarpinski
Copy link
Sponsor Member

@StefanKarpinski StefanKarpinski commented Apr 3, 2019

I think this is a somewhat better API. Boolean arguments are often better as keywords since the value itself conveys so little contextual information. The loopback argument and the type argument are also orthogonal which this allows us to express slightly more easily (i.e. with a single method definition).

@@ -267,7 +269,7 @@ julia> getipaddrs(IPv6)
ip"fe80::445e:5fff:fe5d:5500"
```
"""
function getipaddrs(addr_type::Type{T}, include_lo::Bool=false) where T<:IPAddr
function getipaddrs(addr_type::Type{T}=IPAddr; loopback::Bool=false) where T<:IPAddr
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for adding in the 0-argument method, seems like I forgot that in my PR. ❤️

Copy link
Sponsor Member Author

@StefanKarpinski StefanKarpinski Apr 3, 2019

Choose a reason for hiding this comment

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

You had it, it just couldn’t be specified like this because of the interaction with non-keyword loopback argument. See the method I deleted right below this one.

@StefanKarpinski
Copy link
Sponsor Member Author

AppVeyor and Travis failures don't seem related but man does the CI situation not make me super comfortable to merge anything.

@StefanKarpinski StefanKarpinski added this to the 1.2 milestone Apr 3, 2019
@StefanKarpinski
Copy link
Sponsor Member Author

I want to make sure this gets into the 1.2 release since this is a change to a new API and if it doesn't make it into 1.2 we can't change this in 1.3.

@jpsamaroo
Copy link
Member

Unrelated, but s/gitipaddrs/getipaddrs/ in your commit message

@StefanKarpinski
Copy link
Sponsor Member Author

Reminder to self: squash this when you merge it and fix the commit message.

@StefanKarpinski StefanKarpinski changed the title gitipaddrs: make loopback::Bool argument keyword getipaddrs: make loopback (Bool) a keyword argument Apr 4, 2019
@StefanKarpinski StefanKarpinski merged commit bef16ee into master Apr 5, 2019
@StefanKarpinski StefanKarpinski deleted the sk/loopback branch April 5, 2019 02:33
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