Quoting Marko Ristin-Kaufmann (2018-11-27 10:29:15) > if you could call template hacks really dependent types...
You really couldn't, they're entirely different beasts. > I expect most applications to need wider family of behavioral contracts > -- and I doubt that Go would ever support them natively lest there's a > decision to sacrifice simplicity for modeling correct programs. At the > company I work at we are currently pretty happy with run-time > enforcement of the contracts and I'm not even sure whether a static > checker would be a huge benefit. Sure, for some things capturing the invariant statically is cumbersome enough that you get more millage out of `if(...) { panic(...) }`, and it seems like these contracts are basically syntactic sugar over that -- which is fine. My comments were in the context that Dan had originally asked about static mechanisms. > Having something like Optional type would be probably the most > important contribution to the correctness to prevent nil pointer errors > (and make writing a static checker easier), but I suppose that would be > possible with any sort of generic types in Go2. The problem with doing this in Go: What is the zero value of a non-optional pointer? (If I were doing a clean-slate Go, I'd probably leave zero-values out, but I'm not). -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.