Timeline for Understanding closures
Current License: CC BY-SA 3.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 13, 2016 at 18:19 | comment | added | Erik Eidt | Well, as I said, all good stuff; however, I think @Karl's answer goes more to the actual question asked, which I take as being more about the point the tutorial is trying to make (although badly, perhaps). | |
| May 13, 2016 at 18:13 | comment | added | Robert Harvey | @ErikEidt: I think there's enough material here (including the comment below the question) to allow the OP to draw the conclusion that the example he gave is too contrived to be a good example. | |
| May 13, 2016 at 18:09 | comment | added | Erik Eidt | All good stuff; however, the OP was not asking what are closures, when are they useful, or for a good example of a closure, but rather inquiring about the point of the cited source code example, and the hunch it could be simplified, and if that were the case, then was there something else of value in the example that was not obvious? As such, I don't think this answers the question being asked. | |
| May 13, 2016 at 17:19 | comment | added | Robert Harvey | That is a better example. | |
| May 13, 2016 at 17:03 | comment | added | Philipp | @RobertHarvey I added a second example which you might like better. | |
| May 13, 2016 at 17:00 | history | edited | Philipp | CC BY-SA 3.0 | added 976 characters in body |
| May 13, 2016 at 16:52 | comment | added | Robert Harvey | Sure, but there needs to be a motivation for using the technique. That's what the OP is asking for, not the finer points of closure mechanics (which the OP appears to already understand). | |
| May 13, 2016 at 16:51 | comment | added | Philipp | @RobertHarvey Because I am trying to explain how closures work. | |
| May 13, 2016 at 16:50 | comment | added | Robert Harvey | Nice example, but why not just call CalculateCodeFor(username) directly? | |
| May 13, 2016 at 14:53 | comment | added | Laiv | +1 much better is function is parametrized | |
| May 13, 2016 at 14:32 | history | answered | Philipp | CC BY-SA 3.0 |