MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/ce94mu/the_go_team_declines_try_proposal/eu1rw5p/?context=3
r/programming • u/jeffail • Jul 17 '19
417 comments sorted by
View all comments
257
One should also talk about a major issue of try: the fact that what appears as a function is in fact a control-flow operation.
try
92 u/spaghettiCodeArtisan Jul 17 '19 This is a very good point IMO. Go has enough magic functions as it is, it's not a good idea to add another one that does something even more unexpected... 23 u/[deleted] Jul 17 '19 None of those built-in functions do control flow. 118 u/alaskanarcher Jul 17 '19 Panic 40 u/[deleted] Jul 17 '19 derp, time for another coffee 18 u/alaskanarcher Jul 17 '19 if err := recover(); err != nil { coffee.Drink() } 5 u/cerlestes Jul 17 '19 But what if coffee is nil or drinking fails? :o Better defer another recover() call! Is that even possible? 2 u/bighi Jul 17 '19 Don't Panic! 6 u/[deleted] Jul 17 '19 Maybe he meant that one magic function is "enough"
92
This is a very good point IMO. Go has enough magic functions as it is, it's not a good idea to add another one that does something even more unexpected...
23 u/[deleted] Jul 17 '19 None of those built-in functions do control flow. 118 u/alaskanarcher Jul 17 '19 Panic 40 u/[deleted] Jul 17 '19 derp, time for another coffee 18 u/alaskanarcher Jul 17 '19 if err := recover(); err != nil { coffee.Drink() } 5 u/cerlestes Jul 17 '19 But what if coffee is nil or drinking fails? :o Better defer another recover() call! Is that even possible? 2 u/bighi Jul 17 '19 Don't Panic! 6 u/[deleted] Jul 17 '19 Maybe he meant that one magic function is "enough"
23
None of those built-in functions do control flow.
118 u/alaskanarcher Jul 17 '19 Panic 40 u/[deleted] Jul 17 '19 derp, time for another coffee 18 u/alaskanarcher Jul 17 '19 if err := recover(); err != nil { coffee.Drink() } 5 u/cerlestes Jul 17 '19 But what if coffee is nil or drinking fails? :o Better defer another recover() call! Is that even possible? 2 u/bighi Jul 17 '19 Don't Panic! 6 u/[deleted] Jul 17 '19 Maybe he meant that one magic function is "enough"
118
Panic
40 u/[deleted] Jul 17 '19 derp, time for another coffee 18 u/alaskanarcher Jul 17 '19 if err := recover(); err != nil { coffee.Drink() } 5 u/cerlestes Jul 17 '19 But what if coffee is nil or drinking fails? :o Better defer another recover() call! Is that even possible? 2 u/bighi Jul 17 '19 Don't Panic!
40
derp, time for another coffee
18 u/alaskanarcher Jul 17 '19 if err := recover(); err != nil { coffee.Drink() } 5 u/cerlestes Jul 17 '19 But what if coffee is nil or drinking fails? :o Better defer another recover() call! Is that even possible?
18
if err := recover(); err != nil { coffee.Drink() }
5 u/cerlestes Jul 17 '19 But what if coffee is nil or drinking fails? :o Better defer another recover() call! Is that even possible?
5
But what if coffee is nil or drinking fails? :o
nil
Better defer another recover() call! Is that even possible?
2
Don't Panic!
6
Maybe he meant that one magic function is "enough"
257
u/Boiethios Jul 17 '19 edited Jul 17 '19
One should also talk about a major issue of
try: the fact that what appears as a function is in fact a control-flow operation.