3 ms·
Some people like to solve this problem with 'goto's, as in the 'small' subfunction in https://golang.org/src/pkg/math/gamma.go https://golang.org/src/pkg/math/g
by thomasahle 12y ago
Some people like to solve this problem with 'goto's, as in the 'small' subfunction in https://golang.org/src/pkg/math/gamma.go https://golang.org/src/pkg/math/gamma.go
Personally I'd like to see something like Haskell's "where", to create a scope for private functions in the "B style":
void largerFunction(void) {
small1();
small2();
} where {
void small1(void) {
...
}
void small2(void) {
...
}
}
Until that becomes possible, we can always just make sufficiently small modules with few public functions.
- Too 12y agoCan be achieved with lambdas or anonymous functions in most languages; c#, c++, javascript, python to name a few :)
- thomasahle 12y agoSure, but then you'd have to put the declaration before the function call.