News for hackers. Stuff that matters.
Re:My Go Resolutions for 2017 by bsaul on Wednesday January 18, 2017 @01:06PM (#13428603)
Along with generics, they should probably also reconsider algebraic data types, such a enums with values. This is the best feature swift adds to the table hands on, and it seems to me as it's pretty orthogonal to the rest of the language ( although it carries a lot of other features with it, such as pattern matching).

They wrote that they considered it to be redundant with interface programming, but really i don't understand why. Interface is about behavior, not data. An int doesn't "behave" like one, it is one. And something that's either an int or an array of string, doesn't "behave" like anything you'd want to describe with an interface...

As an example, one should see how protobuf "one of" messages are dealt with in go : switch on arbitrary types followed by manual typecasting. That's just gross...

Re:My Go Resolutions for 2017 by brandonbloom on Wednesday January 18, 2017 @01:20PM (#13428745)
It's redundant because Go already has type-switch and type-assertions. Your comments about ints vs arrays vs behavior misses an important fact: An object of any type can be promoted to interface{} (aka "dynamic") and then may be "pattern matched" on via `x.(type)`. Sure, it's pretty crummy pattern matching to only be able to dispatch on a single tag, but there are some fundamental problems with traditional algebraic data types and pattern matching:

1) Abstract data types encourages closed systems. You may view this as a positive: It enables exhaustiveness checks. But I view it as a way to make your program more fragile. Go's type asserts let you convert to interface types, so you can add new interface implementers later and not have to go fix-up old type-assertions.

2) First-to-match pattern matching complects order with dispatch. Each match clause has an implicit dependency on _all_ of the clauses before it, since you can match Foo{x, 1} and if that fails match Foo{x, y} where you know now that y != 1. This is sometimes useful, but as your patterns grow larger, it's simpler to just match Foo{x, y} and then branch on y == 1. A series of type-asserts with if statements has a little bit of order dependency on it: interface clauses and named wrapper types are first-to-match, but type-switch on struct clauses are completely order independent because there can only be one concrete representation underlying an interface{}.

3) Relying on positional fields causes two classes of problems: A) it's harder to grow your system later, since every pattern match needs to mention the new field you added and B) you can't _not_ mention a field by name (or at least give it a placeholder name) at every use as well. This is the same issue as the Foo{x, y} vs Foo{X: x, Y: y} notation. It's considered good practice in Go to use the later, since it's more future proof, ie Foo may grow a Z field and it will be initialized to zero.

Re:My Go Resolutions for 2017 by dbaupp on Wednesday January 18, 2017 @01:31PM (#13428884)
> so you can add new interface implementers later and not have to go fix-up old type-switches.

Or, rephrased: the compiler doesn't help you find the old type-switches that need new branches.

As you say, being closed gives exhaustiveness checks, and this is often a good thing: it's harder to accidentally not handle new cases in existing code (or not handle existing cases, when writing new code), and it makes refactoring much easier. For some code the flexibility of being open isn't the right choice, just like for some code, it is.

> First-to-match pattern matching complects order with dispatch

This seems orthogonal to ADTs: one can retain retain behaviour like Go's current switch, and only allow switching on the variant, not doing more detailed pattern matching. This retains order independence.

> Relying on positional fields causes two classes of problems

Again, totally irrelevant: one can pattern-match using the names of fields.

Re:My Go Resolutions for 2017 by brandonbloom on Wednesday January 18, 2017 @01:36PM (#13428954)
> the compiler doesn't help you find the old type-switches that need new branches

Presumably you're adding to a "closed" set of types, so it's quite easy to grep for the type names in that type set. I just don't find this to be that much of a problem in practice. Never mind the fact that wildcard clauses exist and so this problem comes up in ML/Haskell/etc as well, since the compiler will consider those patterns exhaustive.

> only allow switching on the variant

Go already has this. It's called type-switch:

https://golang.org/doc/effective_go.html#type_switch

> one can pattern-match using the names of fields

Of course they can, but traditional algebraic data types impose order on to fields, which is an undesirable feature IMHO. However, field dispatch loses the nice order-independence attribute.

Re:My Go Resolutions for 2017 by dbaupp on Wednesday January 18, 2017 @01:47PM (#13429086)
> Presumably you're adding to a "closed" set of types, so it's quite easy to grep for the type names in that type set

Yes, that's an option, but it's not nearly as nice as the compiler automatically telling you what's up, nor does it help downstream users of a library that adds a new possibility. They just have to hope the change is communicated to them.

> Never mind the fact that wildcard clauses exist and so this problem comes up in ML/Haskell/etc as well, since the compiler will consider those patterns exhaustive.

This is an explicit vs. implicit situation: by using a wildcard, the programmer has explicitly chosen to give up some compile-time assistance, whereas Go implicitly makes this choice for the programmer.

> Go already has this. It's called type-switch:

... I don't see how a facetious response like this is at all helpful. The downsides of type-switch are exactly what we're already discussing.

> traditional algebraic data types impose order on to fields, which is an undesirable feature IMHO

Go is its own language, and can choose to adopt/adapt features to suit its idioms. Referring everything back to how "traditional ADTs" work seems silly when there's trivial tweaks that fit Go better.

> However, field dispatch loses the nice order-independence attribute.

I don't know what you mean by this (I can guess, but I don't see how it relates to naming fields in patterns), could you rephrase?

Re:My Go Resolutions for 2017 by brandonbloom on Wednesday January 18, 2017 @01:55PM (#13429166)
> nor does it help downstream users of a library

If you add a new type to a sum type in a statically typed language, that's a breaking change for all downstream consumers. Again, you may view this as a benefit (clients get compiler errors about new cases to handle!), but I view it as a drawback (clients can't upgrade until they handle all new cases!).

> Go implicitly makes this choice for the programmer

And I believe that Go (and Clojure, which omits both types and pattern matching for reasons including those I'm discussing) makes the right decision for the programmer, as openness to future changes without breakage is better > 90% of the time.

> could you rephrase?

You said "one can pattern-match using the names of fields", I took that to mean matching on something like Foo{x: 5}. If you do that and also have a clause Foo{y: 10}, now you have ambiguity and the order you compare x==5 or y==10 first matters, since you might have an object Foo{x: 5, y: 10} which would match both clauses.

If you just meant that you could do Foo{x: x} with blanks, that's fine, we're in agreement then. Clojure offers {:keys [x]} in destructuring for this purpose, and it's great.

Re:My Go Resolutions for 2017 by dbaupp on Wednesday January 18, 2017 @02:06PM (#13429283)
For both of the first points: I don't think anyone's proposing that closed sum types be the only polymorphism in Go (removing the existing open polymorphism would be a wild breaking change and so isn't even a remote possibility), so this would be a feature for when alerting consumers that something has broken is good. When flexibility is what your library needs, use interfaces, when reliability (or performance[0]) is what it needs, use ADTs.

One argument against adding the new feature is it forces people to think about which to use, and they may choose an inappropriate one. (This choice argument is far stronger than vague concerns about the feature possibly resulting in breaking changes.)

In any case, libraries can already make breaking changes, and presumably quite a few want to/do (so it's not like having a feature that can also result in breaking changes is anything new), and, adding a new type to existing open set can easily be a semantic breaking change that stops code from running correctly, even if it doesn't stop code compiling.

> You said "one can pattern-match using the names of fields", I took that to mean matching on something like Foo{x: 5}. If you do that and also have a clause Foo{y: 10}, now you have ambiguity and the order you compare x==5 or y==10 first matters, since you might have an object Foo{x: 5, y: 10} which would match both clauses.

No, that is orthogonal, as I also discussed in my original reply.

I was visualising something like `Foo { x: binding }` in the pattern, which would make the value of the x field available under the name `binding` (and, for convenience, `Foo { x: x }` case could be allowed to be abbreviated to `Foo { x }`). Whether the binding on the right-hand side of a field allows pattern matching or not is its own discussion.

[0]: ADTs aren't forced to allocate, and possibly use a more efficient switching scheme (it's just an integer for an ADT; I don't know the implementation details of Go's type-switch so it might be that fast).

Re:My Go Resolutions for 2017 by brandonbloom on Wednesday January 18, 2017 @02:10PM (#13429317)
I'm going to dodge the breaking changes discussion, since it's a huge tangent, suffice to say that I greatly dislike _breaking_ changes and want languages that make it possible to avoid them or at least provide a migration path via incremental deprecation prior to removal. Go fails here in many ways. All I meant to do was point out that exhaustiveness checks are not without their tradeoffs.

> I was visualising something like

OK then. We're in agreement on that point. This is what Clojure has in it's destructuring syntax, and, as I said, it's great.

Re:My Go Resolutions for 2017 by codygman on Thursday January 19, 2017 @11:51AM (#13437223)
> I'm going to dodge the breaking changes discussion, since it's a huge tangent,

How is it a tangent? One of the biggest reasons to want exhaustiveness checking is to avoid the even uglier problem of "compiling but semantic changing" changes.

> I greatly dislike _breaking_ changes and want languages that make it possible to avoid them

It seems you are only talking about disliking breaking changes that cause your program not to compile whole totally disregarding the danger of changes that compile but change semantics.

As respectfully as possible, that seems backwards to me.

Re:My Go Resolutions for 2017 by dbaupp on Wednesday January 18, 2017 @02:13PM (#13429350)
> All I meant to do was point out that exhaustiveness checks are not without their tradeoffs.

And all I meant to do was point out that lack of exhaustiveness checks is not without its tradeoffs. :)

Re:My Go Resolutions for 2017 by bsaul on Wednesday January 18, 2017 @02:05PM (#13429277)
Imagine an enum describing the various states of a state machine. I'd definitely prefer the compiler to refuse compiling, rather that hoping to be future proof by ignoring a new state.
Re:My Go Resolutions for 2017 by ori_b on Thursday January 19, 2017 @03:32AM (#13434102)
> If you add a new type to a sum type in a statically typed language, that's a breaking change for all downstream consumers.

Yes, but that's true regardless of whether the compiler tells you or not. The question is whether adding the value to the set of types that can be returned breaks at compile time or at run time.

Re:My Go Resolutions for 2017 by spion on Wednesday January 18, 2017 @09:46PM (#13432539)
> If you add a new type to a sum type in a statically typed language, that's a breaking change for all downstream consumers.

Not true, consumers that have an explicit "catch-all" pattern at the end will work normally

Re:My Go Resolutions for 2017 by bsaul on Wednesday January 18, 2017 @01:34PM (#13428927)
I'm thinking pretty much the opposite regarding fragility and growing your system. The fact that adding a case in the enum have the compiler tells you all the places your programm needs to handle the case is a tremendous bonus !

The problem is that we're not talking about the same things. You're talking about making new things behave the way the an existing interface wanted, and i'm talking about a data structure updating.

Once again, interface is not data..

Re:My Go Resolutions for 2017 by brandonbloom on Wednesday January 18, 2017 @01:38PM (#13428975)
> the compiler tells you all the places your programm needs to handle the case is a tremendous bonus

Except this is simply not true if you have any wildcard patterns in any of your matches. Besides, it's easy to grep for one or each of the names of the types in your closed sum. Which is what you're going to do anyway if you have any wild card patterns!

> interface is not data

I don't know what you intend to communicate by saying this.

Re:My Go Resolutions for 2017 by bsaul on Wednesday January 18, 2017 @01:55PM (#13429168)
"this is not true if.." Well, yes indeed, you can ignore features of a language, but i don't see how it prooves any point. As for the grep, i really have no idea what you're talking about ( maybe advanced pattern matching features of advanced language ?). I'm really talking about something very basic, like what swift is doing.

My point about interface vs data is that those are two different things, and that i don't think you can't try to solve an issue on type compositions with a feature working on functions only.

Re:My Go Resolutions for 2017 by lmm on Thursday January 19, 2017 @09:46AM (#13436148)
> 1) Abstract data types encourages closed systems. You may view this as a positive: It enables exhaustiveness checks. But I view it as a way to make your program more fragile. Go's type asserts let you convert to interface types, so you can add new interface implementers later and not have to go fix-up old type-assertions.

Is the idea here that all types should be open? Should I be able to e.g. add 1.5 as a possible instance for the Int and String types?

Interfaces should be open, but one also needs the ability to represent closed datatypes.

Re:My Go Resolutions for 2017 by solatic on Thursday January 19, 2017 @01:06AM (#13433462)
Fragility? Those exhaustive compiler checks are anti-fragile. There's a binary - either your compiler tells you early on where you need to adapt your code, or your automated test suite / customers will tell you in integration / production. Your code is likely to break either way, the question is how early / cheap would you like the fix to be. Code which is cheaper to fix is less fragile QED
Re:My Go Resolutions for 2017 by i_don_t_know on Wednesday January 18, 2017 @01:23PM (#13428791)
I think they thought of the standard OOP solution to algebraic data types. Rather than pattern match on the value and then do the work, you dispatch on the value through an interface and do the work. I don't know go so here's some pseudo code:

    type Foo = { x : int }
    type Bar = { y : string }

    interface DoStuff { doStuff() -> void }

    function Foo.doStuff() {
        ...do stuff with Foo.x
    }

    function Bar.doStuff() {
        ... do stuff with Bar.y
    }

    function main() {
        value := getSomethingThatImplementsDoStuff()
        value.doStuff()
    }
Compare this to ML:

    type DoStuff = Foo of int | Bar of string

    let main =
        let value = getSomethingThatReturnsDoStuff ()
        match value with
        | Foo of x -> ...do stuff with x
        | Bar of y -> ...do stuff with y
Re:My Go Resolutions for 2017 by pcwalton on Wednesday January 18, 2017 @02:35PM (#13429568)
This is basically the expression problem: https://en.wikipedia.org/wiki/Expression_problem

The expression problem is motivated by the fact that the OO style (which Go favors via interfaces) makes adding new cases easy (just add another subclass) but adding new methods hard (you have to modify every subclass), while the pattern matching style makes adding new methods easy (just add another match statement) but adding new cases hard (you potentially have to modify every match statement in the program). Depending on the task at hand, either one may be more advantageous. The solutions to the expression problem are attempts to get the best of both worlds.

A lot of programming language designs deny that this is a tradeoff, which I think is misguided. Sometimes it's more convenient to be able to add methods easily, and sometimes it's more convenient to be able to add cases easily.

Re:My Go Resolutions for 2017 by treehau5 on Wednesday January 18, 2017 @04:29PM (#13430451)
My understanding is go's interfaces is counter to OO style. It's about behavior, not objects, plus by recommending to users that you write the smallest possible interface as you can, and then compose other interfaces out of those smaller one's, you reduce the surface area of where the expression problem can come into practice!
Re:My Go Resolutions for 2017 by pcwalton on Thursday January 19, 2017 @03:39AM (#13434141)
Go's interfaces are pure subclassing for the purposes of the expression problem.
Re:My Go Resolutions for 2017 by zaphar on Wednesday January 18, 2017 @10:56PM (#13432872)
Substitute implementation for subclass and the point still stands.
Re:My Go Resolutions for 2017 by brandonbloom on Wednesday January 18, 2017 @01:29PM (#13428852)
Indent 4 spaces for code.

Here's another way to do this in Go:

    func f(obj interface{}) {
            switch obj := obj.(type) {
            case Foo:
                    // Do stuff with obj.x
            case Bar:
                    // Do stuff with obj.y
            default:
                    return fmt.Errorf("obj is of unexpected type: %T", obj)
            }
    }
Re:My Go Resolutions for 2017 by weberc2 on Wednesday January 18, 2017 @02:10PM (#13429323)
Unfortunately, this makes a runtime error from something that could be caught at compile time.
Re:My Go Resolutions for 2017 by adrusi on Wednesday January 18, 2017 @03:06PM (#13429811)
It's possible to make closed interfaces in Go (give it an uncapitalized method), so there could be a compile-time warning when you don't handle all possible cases in a type switch on a closed interface.
Re:My Go Resolutions for 2017 by weberc2 on Wednesday January 18, 2017 @08:47PM (#13432274)
Maybe this is possible (and I'm not sure it is--this seems like the sort of thing struct embedding would break), but it still doesn't fix that interfaces incur an alloc. Further, it's a shame to abuse interfaces like this; it's not very ergonomic to define a method on a type to denote its membership in a set when we could do something like `type Foo enum { int, Bar, string, []byte }`. None of this is to say implementing real enums in the language is an easy endeavor; only that interfaces are a poor substitute.
Re:My Go Resolutions for 2017 by jerf on Wednesday January 18, 2017 @11:26PM (#13433008)
It is possible, and struct embedding does not break it because struct embedding only enables composition. There is no inheritance, so you can not embed a struct that has something private in it and then "inherit" it and override the private stuff. There is no such thing as inheritance in Go. You can "decorate" methods (in the GoF patterns sense), but the internal implementation that you are decorating only gets the instance of itself, not the decorating class.

I'm not addressing your other points, just your first sentence, since that is a matter of fact I can concretely address.

Re:My Go Resolutions for 2017 by weberc2 on Wednesday January 18, 2017 @11:43PM (#13433072)
> struct embedding only enables composition

Not sure what you mean here. Struct embedding is composition. It enables delegation of methods, which allows the outer struct to satisfy the same interfaces as the inner struct. This necessarily means you can't create closed interfaces. See for yourself: https://play.golang.org/p/akn9rir5of

This holds even if the outer and inner structs are defined in different packages.

Re:My Go Resolutions for 2017 by jerf on Thursday January 19, 2017 @02:16AM (#13433782)
This actually sent me down quite the path of discovery, which yielded to me a couple of surprises which I may have to document somewhere else. But the answer to your question is that you can seal an interface by declaring a private interface that has a private method. If you do that, nobody can construct any type that will implement that, even if they peek in the module and look at the private method name. The compiler will yield up something like:

    src/b/b.go:16: cannot use b (type B) as type 
       a.private in argument to a.CallPrivate:
            B does not implement a.private (missing a.privatemethod method)
                    have privatemethod()
                    want a.privatemethod()
A public interface with a private method does behave a bit interestingly. You can create new structs that compose in the implementation, and if you have a function (not method, function) in the private package that tries to type match on them, it can indeed end up with a type unknown to your package. However, you still have not necessarily "opened the interface" because it remains impossible to ever call a private method on that interface that was not defined in the original package. I haven't tested what public methods do.

I was able to construct a struct that in some sense had two different methods which could both be called under different circumstances with the same short method name, which is a bit weird.

So, in Go, you can completely close an interface such that you'll never get a type you don't expect, or you can close an interface in a way that means you may get an underlying type you didn't expect but the method will still be guaranteed to come from your package.

Re:My Go Resolutions for 2017 by weberc2 on Thursday January 19, 2017 @10:12AM (#13436348)
I believe that you can seal an interface by making it and its method(s) private, but that doesn't do us much good because we're talking about using this to build something that looks like an enum (complete with compiler warnings when we fail to address a branch in a type switch). If you only intend to use your "enum" in the package, then the interface isn't sealed in the scope you want to use it. If you want to use the enum outside of your package, then you can't use the private interface at all.

So you can create a "sealed interface" only in the sense that you can't use it at all outside of its defining package, and it won't be sealed inside of its defining package. I can't see a way to build an enum from this in the way the OP described.

Re:My Go Resolutions for 2017 by i_don_t_know on Wednesday January 18, 2017 @01:32PM (#13428901)
Thanks for the formatting help!
Re:My Go Resolutions for 2017 by xyzzy_plugh on Wednesday January 18, 2017 @01:15PM (#13428689)
I see where you are coming from, but that isn't the go way.

Switch on arbitrary types, followed by typecasting? That's the go way. No surprises. Explicit instead if implicit behavior.

Re:My Go Resolutions for 2017 by coldtea on Wednesday January 18, 2017 @01:22PM (#13428781)
If anything, ADT's would make it even more explicit. And pattern matching will make it impossible to miss cases.
Re:My Go Resolutions for 2017 by bsaul on Wednesday January 18, 2017 @01:24PM (#13428801)
If you have a look at swift, it's also very explicit, and non-magical ( which is why i like it so much). The difference with go is that you can't make any type error when unwrapping the enum, because the compiler knows what are the different possibilities.

I see no reason for go not to adopt it, in all honesty. it's nothing like generics, because it doesn't seem to add complexity to the rest of the language ( imho ).

Re:My Go Resolutions for 2017 by brandonbloom on Wednesday January 18, 2017 @01:31PM (#13428894)
> you can't make any type error when unwrapping the enum

This is also true in Go with type switches:

    switch y := x.(type)
        case MyStruct:
And with type assertions:

    y, ok := x.(MyInterface)
In both cases, y is of the correct type. The ok is optional, if omitted and the assertion fails, you'll get a runtime panic.
Re:My Go Resolutions for 2017 by dbaupp on Wednesday January 18, 2017 @01:36PM (#13428953)
y is of the type you asked for, yes, but that isn't necessarily the type that should be there if the programmer makes a mistake, or if the underlying code changes. With an enum, the types are written in one place, and the compiler connects the dots, giving compile-time errors about mistakes/mismatched expectations. This similar to how one can call `foo(x)` and the return value's type is known, no need to first cast the function to the type the programmer thinks it should be. The casting pushes type errors to execution-time rather than compile-time.
Re:My Go Resolutions for 2017 by brandonbloom on Wednesday January 18, 2017 @01:43PM (#13429037)
> The casting pushes type errors to execution-time rather than compile-time

Which is exactly what pattern matching does, which is what I was responding about.

Re:My Go Resolutions for 2017 by bsaul on Wednesday January 18, 2017 @02:02PM (#13429242)
Ok, i'm starting to understand what we're disagreeing on. You're talking about pattern matching with dynamic expressions ( don't know the official name for that), such as what you find in erlang, i'm talking very basic enum unwrapping based on types, which is compile time checked. Swift also adds some kind of dynamic expression to patterns, which may break exhaustiv checking, but in the case of go, just a simple type check would be a great start.

Edit ( since i can't reply) : just look at https://developer.apple.com/library/content/documentation/Sw... with something like the barcode example.

It's all compile time checked.

Re:My Go Resolutions for 2017 by brandonbloom on Wednesday January 18, 2017 @02:05PM (#13429273)
> very basic enum unwrapping based on types, which is compile time checked

Sooo just accessing fields on a struct? I don't understand the distinction you are trying to make.

Re:My Go Resolutions for 2017 by dbaupp on Wednesday January 18, 2017 @02:12PM (#13429338)
It's like accessing fields on a struct, where you can only access the ones that are guaranteed to be valid. For instance, in existing Go, the struct method would be having two fields, * X and * Y, where (in theory) exactly one of them is non-nil, but both can still be accessed. This requires manually maintaining this invariant (and remembering to check when accessing), as well as sacrificing performance by allocating. Using an ADT would allow storing the X and Y by value, as well as guaranteeing that the invariant of "X xor Y" is always true.
Re:My Go Resolutions for 2017 by brandonbloom on Wednesday January 18, 2017 @02:27PM (#13429496)
Sounds like type-assertions cover that use case just fine. However, you are correct that you can't do this without allocating. ¯\_(ツ)_/¯
Re:My Go Resolutions for 2017 by dbaupp on Wednesday January 18, 2017 @02:34PM (#13429559)
As people keep saying, type assertions do not have as strong compile time assurances as ADTs.
Re:My Go Resolutions for 2017 by brandonbloom on Wednesday January 18, 2017 @02:39PM (#13429603)
And as I keep saying: I don't value those assurances and in fact find them to be a net loss when accounting for breaking changes changes to clients.
Re:My Go Resolutions for 2017 by codygman on Thursday January 19, 2017 @12:32PM (#13437536)
You pay the price of getting the bugs and edge cases out regardless of whether you have compile time assurances.

The complexity is inherent and you can either choose to make it implicit and play the losing game of ensuring it doesn't fail with tests or make it explicit from the outset.

Re:My Go Resolutions for 2017 by dbaupp on Wednesday January 18, 2017 @03:54PM (#13430176)
You personally not valuing the differences is very different to not having any differences, and the latter is what a lot of your comments seem to be implying, including the one I was replying to.
Re:My Go Resolutions for 2017 by bsaul on Wednesday January 18, 2017 @01:38PM (#13428979)
I'm sorry, i meant trying to unwrap to a type that's not even possible ( and forgeting to check for one that is). Sure, there are ways to dynamically ensure typecasts have succeeded.
Re:My Go Resolutions for 2017 by brandonbloom on Wednesday January 18, 2017 @02:06PM (#13429286)
Go will give you errors for "impossible type assertions" in many cases.
Re:My Go Resolutions for 2017 by codygman on Thursday January 19, 2017 @12:29PM (#13437508)
> The ok is optional, if omitted and the assertion fails, you'll get a runtime panic.

Great, now my enums can panic because I have to play "be the typechecker", instead of focusing on something actually important like business logic.

How is this not seen as universally a bad thing?

Re:My Go Resolutions for 2017 by stewbrew on Wednesday January 18, 2017 @03:23PM (#13429953)
I don't understand the downvotes since that's about the official stance of the go team -- see the FAQ (cited somewhere else). Agree with it or not.
Re:My Go Resolutions for 2017 by rwj on Wednesday January 18, 2017 @01:23PM (#13428785)
Not recommending either way, but if the language supported algebraic types with pattern matching, it would still be explicit.
Re:My Go Resolutions for 2017 by dbaupp on Wednesday January 18, 2017 @01:20PM (#13428748)
Maybe you're visualising something different, but I don't see how ADT enums are implicit. Could you explain?
Re:My Go Resolutions for 2017 by stewbrew on Wednesday January 18, 2017 @03:21PM (#13429950)
Might be relevant: https://golang.org/doc/faq#variant_types

Sometimes one wishes people from the go time would have spent some time hacking ML-derived languages.