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

quaternions?! This is exactly something I need but never would have expected in the base language.



Look at the date the issue was opened and closed...


Ok, that makes more sense than a quaternion library :(


I'm actually surprised Go even has a complex type in it, honestly. The places where you'd use it and the types of programs you'd use Go for don't strike me as overlapping much.


There's been some interesting discussion about the possibility of removing them in go 2 https://github.com/golang/go/issues/19921


C supports complex arithmetic. That was a real surprise for me.


This was added in C99 as part of a set of features that were all motivated by trying to make C a more viable competitor to Fortran for scientific and numeric code.


Did it work, or did nobody migrate from Fortran to C?


My understanding is that 1) the implementations didn't really deliver in the optimization department, and 2) the most crucial features (like VLAs) remained poorly supported and or/buggy for a long time.


The code actually exists and you can patch it into your own Go-compiled-from-source version


Usually with languages that are feature rich they can be plain library types.

With Go, they will keep adding special case after special case.


> Usually with languages that are feature rich they can be plain library types.

Eh, in most languages you'd still need language support if you want quaternion literals.


Literals are usually not a big issue. You don't get that much in going from "1 + 2i" to "complex(1, 2)" or something like that. It's value type semantics, operator overloading, and implicit conversions that are usually challenging.

Go doesn't have any form of customized operator overloading. If something needs to look like a number, it has to be in the base language. Stuff that isn't, is second-class even if it's in the standard library.

Ironically, this is the case for big integer / floating-point numbers - you have to write things like x.Add(y, z): https://golang.org/pkg/math/big/


You may have point. Though in this case it was 1st april joke.


Ah I see.





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

Search: