Re:Having a Go - first time experience with Golang
by jkn on Monday July 09, 2012 @01:42PM
(#4219313)
Sorry but I think your idea would just make the language less consistent. A call is a call, it can be deferred or made asynchronous (with the go keyword). In the latter case at least it is very common to specify arguments. Having a syntax to defer a function call, that only works with functions that take no argument, would be weird and inconsistent.
Would you really? Most of the examples I see over and over take no argument, the common case most definitely seem to be that. Not to mention it is not hard to design a HoF wrapping a callable and arguments, and deferring the application of one to the others.
> The syntax of the 'defer' keyword is obviously designed to match the syntax of the 'go' keyword for launching Goroutines
Which I consider problematic for the same issue.
> it would be annoying to wrap every 'go' call with arguments in an anonymous function without arguments.
No more annoying that calling functions being deferred, or coping with the weird irregularity of evaluating all sub-expressions but not the top-level one.