News for hackers. Stuff that matters.
Re:Functional Thinking after OO by silentbicycle on Tuesday March 15, 2011 @03:28PM (#2328985)
In statically typed languages, that's usually avoided, because a typo in a function name can escalate to subtle bugs.

Also, working with partial information complicates the type inference; in your example, at best, it could infer () -> `a for getData, `a -> `b for processData, and `b -> () for outputData.

In some languages (such as Smalltalk, Lua, and Ruby), there is an explicit "message not understood" hook that is called when a nonexistent function is referenced, and you can define stub behavior there.

Re:Functional Thinking after OO by ww520 on Tuesday March 15, 2011 @04:03PM (#2329130)
Good point about the function name typo in static type language. Provisional and complete functions are supposed to be different. The compiler can have a validation mode to flag all provisional functions, which would catch the wrong function name intended for a complete function.

The "message not understood" hook in dynamic languages is good for runtime handling of missing functions, but I actually want the compiler to generate the source code for the provisional functions, to make exploratory development easier.

Re:Functional Thinking after OO by silentbicycle on Tuesday March 15, 2011 @04:10PM (#2329163)
IIRC, Haskell has some explicit marker for adding stub functions ("doThatStuff x y z = undefined" or something like that). You still write the names for the function and any arguments, though.

I tend to write code bottom-up rather than top-down, testing it in a REPL and/or with tests, but have Emacs functions to generate boilerplate for languages that need it.