Hacker News new | past | comments | ask | show | jobs | submit login

I like the author's general idea that there should be a separate, mostly-opaque type for 2D and 3D angles.

2D angles are represented by floats, and 3D angles are represented by Quaternions. Which is fine internally, but a smart language should provide an inline wrapper type.

Typing 2D angles as floats presents issues when wrapping: x and 2pi * x will look and mostly function the same, but can lead to edge cases e.g. comparisons and loss of precision.

Typing 3D angles makes them easier to understand, since you won't be doing high-level mathematical operations, you'll just be rotating to face x or rotating by y degrees perpendicular to vector z.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: