Honestly, #golang still confuses me daily.
This snippet compiles but segfaults, but removing the embedded interface on line 8 actually makes compilation fail, as one would expect. What is going on here? Why does *adding* an interface to the struct makes it less safe?
@kassner `a.Perform()` is shorthand for `a.Action.Perform()` -- in other words, "Action" is a field in ActionA and it happens to be nil because no value has been assigned to it.
@serickson I understand that from the structs. But what is the rationale to have the same behavior for interfaces, given they can't have implementations themselves?
@serickson I understand that.
My questioning is why my initial code segfaults instead of doing the proper type-check. If interfaces must be implemented, why isn't the compiler validating this?