You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes we just want to represent an IP address (#10408 reminded me of this issue). This has already caught me in the past to have to put a 0 in a place we just want to represent an IP, where we just want to calculate masks for instance.
Sure, that could be useful sometimes. But IMO it would not be worth it adding another type, when you can just use Socket::IPAddress with port 0 for example (and ignore port if you only care about the address).
The naming can obviously be confusing. The type is called IPAddress but actually, it consists of the combination of address and port number. This could probably more correctly be called "port", but that would be confusing for similar reasons.
For all practical purposes, I think we're fine with the current situation. It's not ideal, but there's no strictly better solution. And I don't imagine adding another type would be useful for stdlib.
When listing other implementations of such a type, you should also mention if there's also a separate type for the combination with a port number like in Go. If not, our IPAddress is just like the other languages' type, just with the possibility to also specify a port number.
Sometimes we just want to represent an IP address (#10408 reminded me of this issue). This has already caught me in the past to have to put a
0
in a place we just want to represent an IP, where we just want to calculate masks for instance.Examples of other places which has such type:
The text was updated successfully, but these errors were encountered: