News for hackers. Stuff that matters.
Re:I Want Off Mr. Golang's Wild Ride by throwaway894345 on Friday February 28, 2020 @12:58PM (#22444744)
I agree that the standard library database tooling is really clumsy in a lot of cases, but it's the library implementation at fault, not Go itself. Notably, contrary to your last sentence, you aren't troubling yourself with "weird Go semantics", you're troubling yourself with the semantics of the database stdlib.
Re:I Want Off Mr. Golang's Wild Ride by whateveracct on Friday February 28, 2020 @01:15PM (#22444929)
Is there a database library that uses reflection that properly descends into type aliases? Probably not, because it isn't always what you want.

It's still fundamentally caused by Go's shitty design choices.

encoding/json is at fault as well, which is also in the stdlib and a flagship library (basically part of the language - the maintainers wouldn't even extend its struct tag parsing to allow for required fields it's so fundamental!)

Proof that this issue affects JSON: https://play.golang.org/p/erfcSIe-Z7b

Re:I Want Off Mr. Golang's Wild Ride by gwd on Friday February 28, 2020 @05:02PM (#22446835)
> It's still fundamentally caused by Go's shitty design choices.

I mean, come on. In your playground example, one way of using the UUID type inherits its methods and another doesn't. Inheritance is inherently complicated, and if you're relying on it you need to know what you're doing, no matter what language you're using. I wouldn't call that a poor design choice.

Re:I Want Off Mr. Golang's Wild Ride by whateveracct on Friday February 28, 2020 @05:14PM (#22446910)

    newtype NotRobPike'sUUID = NotRobPike'sUUID UUID deriving newtype (ToJSON, FromJSON)
^ not inherently complicated
Re:I Want Off Mr. Golang's Wild Ride by throwaway894345 on Friday February 28, 2020 @05:35PM (#22447050)
I'm not sure you're making the point you think you are.
Re:I Want Off Mr. Golang's Wild Ride by whateveracct on Friday February 28, 2020 @05:41PM (#22447085)
My point is if you Do Better than cargo cult stuff that feels nice, you can solve the original problem nicely.
Re:I Want Off Mr. Golang's Wild Ride by JohnCampbell on Friday February 28, 2020 @07:32PM (#22447731)
> Is there a database library that uses reflection that properly descends into type aliases?

The database package uses a type assertions to find the methods, not reflection.

Go types have one level of underlying type, not multiple levels as you seem to be assuming. Go is simplistic compared to other languages in this regard.

A type definition defines a new type using the underlying type of some other type.

I can understand the complaint that Go does not have the aliasing feature that you want, but the database/sql and encoding/json packages work exactly as expected given Go's simple model.