Crystal: Documentation of RemoteAddressType for HTTP::Request#remote_address

Created on 10 Jun 2020  路  4Comments  路  Source: crystal-lang/crystal

In https://github.com/crystal-lang/crystal/pull/9210, the return value of this method is now the private alias RemoteAddressType. The rendered documentation now presents an unknown, undocumented type.

image

Reading the PR, this doesn't look like it was a consideration. Leaking the name of the private type doesn't seem like the best situation for users discovery - can this be improved? Perhaps RemoteAddressType can stay private like this, but I think its platform variants should at least be enumerated in the documentation.

I think there are other precedents for this sort of platform aliases, but I can't think of them right now...

bug docs windows

All 4 comments

The solution is to avoid using an alias.

Stdlib APIs are supposed to be platform independent. That includes return types must not be different depending on the platform. This should just return nil on win32 for now.

@bcardiff This is not specific to windows. It affects API and documentation for all platforms.

I know, but is because Socket is not implemented yet on windows. If this is solved for now by returning nil on Windows I'm good.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oprypin picture oprypin  路  3Comments

pbrusco picture pbrusco  路  3Comments

nabeelomer picture nabeelomer  路  3Comments

cjgajard picture cjgajard  路  3Comments

costajob picture costajob  路  3Comments