User talk:Dchapes: Difference between revisions

Content added Content deleted
Line 12: Line 12:
:::You can always add subpages. If you just go to http://rosettacode.org/wiki/task_name/Go/whatever_test.go you can create the page, add the text of your test file, and then add a link on the main Go example. We already make subpages for long examples (e.g. [[Pythagorean triples/Java/Brute force primitives]]) so it's not out of the ordinary. Putting links on the task pages to separate pages with more detailed information sounds like a great way to let people dig deeper if they so choose. --[[User:Mwn3d|Mwn3d]] ([[User talk:Mwn3d|talk]]) 15:45, 3 September 2014 (UTC)
:::You can always add subpages. If you just go to http://rosettacode.org/wiki/task_name/Go/whatever_test.go you can create the page, add the text of your test file, and then add a link on the main Go example. We already make subpages for long examples (e.g. [[Pythagorean triples/Java/Brute force primitives]]) so it's not out of the ordinary. Putting links on the task pages to separate pages with more detailed information sounds like a great way to let people dig deeper if they so choose. --[[User:Mwn3d|Mwn3d]] ([[User talk:Mwn3d|talk]]) 15:45, 3 September 2014 (UTC)


== Go Secure temporary file task. ==
== [[Secure_temporary_file#Go|Go Secure temporary file task]]. ==


Should we close the file too? I think it gets closed when the process ends but I'm with the people who don't like to rely on that. It could either be a separate defer or we could defer a literal with both the Close and Remove.
Should we close the file too? I think it gets closed when the process ends but I'm with the people who don't like to rely on that. It could either be a separate defer or we could defer a literal with both the Close and Remove.


To get fancy we could put the existing code in a function, have that function stat the file, return the file name to main, then have main stat the file and show that it's been removed. ...To get even fancier we could fire off a thousand concurrent functions and check all errors to show there are no collisions. —[[User:Sonia|Sonia]] ([[User talk:Sonia|talk]]) 19:20, 29 December 2014 (UTC)
To get fancy we could put the existing code in a function, have that function stat the file, return the file name to main, then have main stat the file and show that it's been removed. ...To get even fancier we could fire off a thousand concurrent functions and check all errors to show there are no collisions. —[[User:Sonia|Sonia]] ([[User talk:Sonia|talk]]) 19:20, 29 December 2014 (UTC)
:Not closing the file was a silly oversight. Also note that (at least on sane OSes) if the file doesn't need to be re-opened the file could be immediately removed while still open and being read+written to avoid the case where sudden termination (e.g. SIGINT) prevents simple cleanup/removal.
:However, I purposelessly avoided making the example too complicated, I actually liked the original that effectively just pointed out the relevant function, except that the function is explicitly documented as requiring the caller to remove the file so I felt adding that was important. I also wanted to demonstrate that the argument was used as a prefix for a random name and was put into a reasonable directory by default. —[[User:dchapes|dchapes]] ([[User talk:dchapes|talk]] | [[Special:Contributions/dchapes|contribs]]) 20:06, 29 December 2014 (UTC)