Skip to content

update rbs signatures to be more consistent with generics#2867

Open
sampersand wants to merge 1 commit intoruby:masterfrom
sampersand:swesterman/2026-03-05/rename-from-Elem-to-T
Open

update rbs signatures to be more consistent with generics#2867
sampersand wants to merge 1 commit intoruby:masterfrom
sampersand:swesterman/2026-03-05/rename-from-Elem-to-T

Conversation

@sampersand
Copy link
Contributor

@sampersand sampersand commented Mar 5, 2026

TL;DR: This migrates RBS signatures to use single-characters instead of multiple charcaters.

RBS is a bit inconsistent about how generic variables (eg Foo[X, Y]) are named: Some of them are long (Array[Elem], Enumerable[Elem], ObjectSpace::WeakMap[Key, Value]), whereas some of them are short (Hash[K, V], Set[A], and most exceptions like FrozenError[T], KeyError[K, R].)

I talked with @soutaro about this, and he liked the idea of the one-charcater variables (which I'm also partial to—it's how most langauges work, and makes it easier to distinguish them from classnames). This PR implements that

@sampersand sampersand marked this pull request as draft March 5, 2026 22:06
@sampersand sampersand force-pushed the swesterman/2026-03-05/rename-from-Elem-to-T branch from fc974c2 to f07be48 Compare March 5, 2026 22:17
@sampersand sampersand marked this pull request as ready for review March 5, 2026 22:19
@sampersand sampersand force-pushed the swesterman/2026-03-05/rename-from-Elem-to-T branch from f07be48 to 648b3c9 Compare March 5, 2026 22:23
@ParadoxV5
Copy link
Contributor

I prefer E for Element. Just sayin’

@sampersand sampersand force-pushed the swesterman/2026-03-05/rename-from-Elem-to-T branch from 648b3c9 to 04dbd0b Compare March 5, 2026 22:40
@sampersand sampersand force-pushed the swesterman/2026-03-05/rename-from-Elem-to-T branch from 04dbd0b to 7b97246 Compare March 5, 2026 22:41
@sampersand
Copy link
Contributor Author

I prefer E for Element. Just sayin’

Done. It also prevents a lot of annoying conflicts where T was already used as a generic (eg Array.find: [T]( ...))

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.

2 participants