|
|
|
|
|
by abc_lisper
4878 days ago
|
|
* C: function pointer is a hack. The evidence of this is in the code. Most people don't even know it can be done, and it is rarely done in code(in some central piece no body looks at) * Pascal: It's been a decade since I last looked at it, but I don't know if procedural type can be passed around. * Java: Yep, Java doesn't have first class functions. Will give you that. However, in his example, Yegge was talking as if everything in Java has to be a object, and that somehow functions cannot be called without an associated object. If you think C function pointers are a valid argument, I can provide a similar hack in java http://pastebin.com/cSJ8ffar You can call as many methods as you want. It is disturbing to me when people think C is some holy grail. C, at it is best, is conceptually weak. It is great for working with hardware, but for language features, it would be at the bottom of my list to look at. |
|
Alas, all the alternate functions are defined in one place in advance for the caller/user of "funcMap()", which makes it hard for an app to put in definitions for a library. To get out of that, you have to make an interface than funcMap()'s container implements, and add more code -- Yegge's point! (verbosity)
It's still a useful technique, just verbose.