-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Labels
priority: mediumNormal priorityNormal prioritytype: refactorCode cleanup, no behavior changeCode cleanup, no behavior change
Description
The wgpu package exposes ~81 type aliases (type T = source.T) from gputypes (75) and hal (6) packages.
Go type aliases were designed for gradual code refactoring transitions, not permanent public API (Go Blog, Type Alias Proposal).
Potential problems
- Leaking implementation —
hal.Extent3Dvisible in godoc/errors instead ofwgpu.Extent3D - No encapsulation —
hal/gputypeschanges automatically affect public API - Cannot add methods — aliases don't support wgpu-specific methods
- Tight coupling — public API directly tied to internal package structure
Current state
// descriptor.go — HAL aliases (6 types, leaks implementation layer)
type Extent3D = hal.Extent3D
type Origin3D = hal.Origin3D
type DepthStencilState = hal.DepthStencilState
// types.go — gputypes aliases (75 types)
type TextureFormat = gputypes.TextureFormat
type BufferUsage = gputypes.BufferUsage
// ...Research needed
Before any action, deep investigation is required:
- Severity assessment — is this a real problem or cosmetic? Audit godoc, compiler errors, IDE behavior with actual aliases
- HAL aliases vs gputypes aliases — different concerns.
halis implementation layer,gputypesis shared vocabulary. May need different treatment - Industry analysis — how do mature Go libraries handle multi-layer type exposure? (K8s client-go, gRPC-Go, Terraform SDK, etc.)
- Go 1.24+ generic type aliases — does this change the calculus?
- Breaking change scope — how many downstream call sites across
gogpu,gg,ui? - Migration strategy — if fix is needed, gradual deprecation or major bump?
Deliverable
Research document with:
- Findings for each question
- Severity rating (cosmetic / moderate / critical)
- Recommendation: fix / accept / partial fix
- If fix: implementation plan. If accept: documented rationale.
References
- Go Blog: What's in an Alias Name
- Type Alias Proposal
- Dave Cheney: Use internal packages
- Discovered during PR [feat] Add WriteTexture to Queue #95 review
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
priority: mediumNormal priorityNormal prioritytype: refactorCode cleanup, no behavior changeCode cleanup, no behavior change