Skip to content

Refactor block type restriction underscore output to nil#10938

Draft
straight-shoota wants to merge 1 commit intocrystal-lang:masterfrom
straight-shoota:feature/block-restriction-underscore
Draft

Refactor block type restriction underscore output to nil#10938
straight-shoota wants to merge 1 commit intocrystal-lang:masterfrom
straight-shoota:feature/block-restriction-underscore

Conversation

@straight-shoota
Copy link
Member

This patch replaces underscore output types in block restrictions with nil (empty) for methods where the result of the yielded block is irrelevant and unused. Underscore should be used where the result type is not specified but the value is actually used.

See #10931

This had previously been a part of #10929

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. kind:docs topic:stdlib labels Jul 13, 2021
@beta-ziliani
Copy link
Member

I wonder if it would break things to explicit the Nil return type when that's the intention (e.g., each)

@straight-shoota
Copy link
Member Author

Nil and empty should be semantically equivalent here. We could use Nil, it's just more characters.

@beta-ziliani
Copy link
Member

right, but given that the semantics are somewhat not entirely there, maybe it makes sense to be explicit for once

@straight-shoota straight-shoota marked this pull request as draft July 14, 2021 09:08
@straight-shoota
Copy link
Member Author

Let's discuss the intended semantics in #10931

I just opened this PR to not loose the these parts of #10929. It should have been a draft from the beginning, to wait for a definitive decision in #10931.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:bug A bug in the code. Does not apply to documentation, specs, etc. kind:docs topic:stdlib

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants