Objective-C lightweight generics break type-as-key concept
Open
Nobody has claimed this yet.
bug
help wanted
- Dominant language
- Swift
- Stars
- 43
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
Problem
Objective-C generics are type-erased at runtime, which breaks the type-as-key concept:
ObjectIdentifier(NSArray<NSString>.self) == ObjectIdentifier(NSArray<NSNumber>.self) // true!
This means two different implicit keys using ObjC generic types will collide.
Cause
ObjC "lightweight generics" don't preserve type parameters at runtime - they exist only for compile-time type checking.
Potential Solutions
- Detect and warn about ObjC generic types used as implicit keys
- Document the limitation
- Require named keys (keypaths) for ObjC generic types
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the implicit-key handling that uses ObjectIdentifier and inspect how generic types are represented at runtime. Reproduce the collision with NSArray and NSArray; done requires an agreed resolution among warning, documentation, or named-key enforcement, with tests covering the chosen behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- objective-c, swift
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100