go-gl / mathgl

A pure Go 3D math library.
BSD 3-Clause "New" or "Revised" License
554 stars 65 forks source link

Proposal: Move the float64 methods into another package #11

Closed UserAB1236872 closed 10 years ago

UserAB1236872 commented 10 years ago

At the moment, functions that operate on float32 values end in f and float64 end in d (except some outliers in the utilities). It seems more Go-like, and perhaps overall better, to separate the packages into mathgl (root level) and mathgl64 (float64 methods).

This would be an API-breaking change. All methods would lose their suffix, e.g. mathgl.Perspectivef -> mathgl.Perspective.

The makefile would work the same, it would just copy and gofmt -w -r in a separate directory.

One note is that OpenGL only works with float32 values unless a specific extension is enabled (and I don't think the go-gl bindings even support the extension), so the double functionality likely doesn't get much use anyway.

If anybody watching this package has opinions, please voice them.

UserAB1236872 commented 10 years ago

To be clear, the float64 methods would still be in Jragonmiris/mathgl. Just a subfolder, not another repository.

dmitshur commented 10 years ago

+1 for this, except I think it's better to put both float32 and float64 packages on the same level, instead of treating one as the default and another as a special case.

One note is that OpenGL only works with float32 values unless a specific extension is enabled (and I don't think the go-gl bindings even support the extension), so the double functionality likely doesn't get much use anyway.

This may or may not be true today, but it may very well change over time. What if float128 is added in the future?

I'd rather see two equal import paths like:

github.com/Jragonmiris/mathgl/mathgl32 github.com/Jragonmiris/mathgl/mathgl64

Or perhaps shorter package names like mgl32 and mgl64.

That way the current API doesn't have to be broken. And everything can still be generated automatically via gofmt.

pwaller commented 10 years ago

:+1: sounds great to me!

pwaller commented 10 years ago

How about /go-gl/mathgl/{32,64}?