News for hackers. Stuff that matters.
Re:How to Use Go Interfaces by catnaroek on Monday March 19, 2018 @11:18PM (#16625755)
If you want data abstraction to do at least a minimum of static invariant enforcement, you pretty much have to use abstract data types. But if you're fine with littering logs with “exception was caught here, such and such data structure was corrupted”, suit yourself.
Re:How to Use Go Interfaces by seanmcdirmid on Tuesday March 20, 2018 @12:32AM (#16626085)
It isn’t that. Abstract data types are designed specifically for data structures like queues and stacks, they don’t make much sense for objects that don’t have such well defined invariants. No major language has adopted them for that reason.
Re:How to Use Go Interfaces by catnaroek on Tuesday March 20, 2018 @03:46AM (#16626633)
> Abstract data types are designed specifically for data structures like queues and stacks

Guess what all nontrivial programs manipulate in the end.

> objects that don’t have such well defined invariants

... are either stateless or useless. It is impossible to define useful algorithms that manipulate objects of which you cannot say anything.

> No major language has adopted them for that reason.

The real reason is “programmers cannot reason about invariants anyway”.

Re:How to Use Go Interfaces by landryraccoon on Tuesday March 20, 2018 @02:47AM (#16626435)
Abstract data types are pretty good if the concrete types are machine generated.