Category talk:Go: Difference between revisions

update after solution of shell one-liner.
(Update on exception task, added notes on remaining omitted tasks.)
(update after solution of shell one-liner.)
Line 42:
===Dynamic variable names===
No variable names exist at runtime. Even the reflect package doesn't have them. (Field names, but not variable names.)
 
===Exceptions/Catch an exception thrown in a nested call (Solved!)===
The specific wording of the task description excludes Go. It specifies that foo call bar, bar call baz, and foo catch U0. The only execption-like mechanism we have is panic/recover. If foo defers a function that uses recover, it can catch a panic, but it ''cannot continue executing.'' Deferred means deferred to the end and foo is ending one way or another the first time a panic gets to it.
 
One totally contrived solution would be to make the second call to bar from within the deferred function. I think most anyone would cry foul at that.
: It strikes me as plausibly appropriate you raise this issue in the task page, and suggest that the task be renamed. It sounds like either a better name for the task might be "Recover from a thrown exception", or that the task should perhaps be adjusted to more cleanly reflect a core intent. --[[User:Short Circuit|Michael Mol]] 02:26, 30 April 2011 (UTC)
 
:: OK, with hindsight, the task might be better ''described'' as "Exceptions/Catch one of two exceptions thrown in a nested call"; but it is unwieldly for a title. I think the title is not misleading, just a precis of the task requirements. --[[User:Paddy3118|Paddy3118]] 11:43, 30 April 2011 (UTC)
 
Update: Solution posted! After some gnashing of teeth, and ultimately eating of words, I settled on a pretty good rendition of the try/catch pattern to post for this task. It doesn't meet the task to the letter, but I think certainly does in spirit. —[[User:Sonia|Sonia]] 01:45, 3 May 2011 (UTC)
 
===Extend your language===
Line 85 ⟶ 75:
===Respond to an unknown method call===
Static, static, static. Go is static.
 
==Once omitted, now solved!==
===Exceptions/Catch an exception thrown in a nested call (Solved!)===
The specific wording of the task description excludes Go. It specifies that foo call bar, bar call baz, and foo catch U0. The only execption-like mechanism we have is panic/recover. If foo defers a function that uses recover, it can catch a panic, but it ''cannot continue executing.'' Deferred means deferred to the end and foo is ending one way or another the first time a panic gets to it.
 
One totally contrived solution would be to make the second call to bar from within the deferred function. I think most anyone would cry foul at that.
: It strikes me as plausibly appropriate you raise this issue in the task page, and suggest that the task be renamed. It sounds like either a better name for the task might be "Recover from a thrown exception", or that the task should perhaps be adjusted to more cleanly reflect a core intent. --[[User:Short Circuit|Michael Mol]] 02:26, 30 April 2011 (UTC)
 
:: OK, with hindsight, the task might be better ''described'' as "Exceptions/Catch one of two exceptions thrown in a nested call"; but it is unwieldly for a title. I think the title is not misleading, just a precis of the task requirements. --[[User:Paddy3118|Paddy3118]] 11:43, 30 April 2011 (UTC)
 
Update: Solution posted! After some gnashing of teeth, and ultimately eating of words, I settled on a pretty good rendition of the try/catch pattern to post for this task. It doesn't meet the task to the letter, but I think certainly does in spirit. —[[User:Sonia|Sonia]] 01:45, 3 May 2011 (UTC)
 
===Shell one-liner===
Go has no standard interpreter...yet.
 
Update: Solution posted. The task really just says ''avoid'' relying on the shell. Doesn't say you can't, if that's the only way to do it. Two solutions posted, one kind of a hack and the other practical, using a popular external command that can be installed. —[[User:Sonia|Sonia]] 22:18, 27 May 2011 (UTC)
1,707

edits