[erlang-questions] Function Dependency
Richard O'Keefe
ok@REDACTED
Tue Aug 21 00:58:06 CEST 2012
On 21/08/2012, at 9:48 AM, Justin Calleja wrote:
>
> Here's one instance that comes to mind with regards to wanting part of a function definition (i.e. just some of it's clauses):
> When implementing a gen_server you handle synchronous requests using handle_call/3. You might just want the implementation of handle_call/3 which deals with certain messages.
Yes, but that part
- might be more than one clause
- which need not be contiguous in the function
- and some or all of them might be shared with the handling
of other messages.
It is possible to deliberately construct a function as a
collection of clauses with small non-overlapping heads that
simply redirect to other functions, so that it would make
sense to extract part of _that_ function, and you would
do so *not* by extracting the clause but by simply picking
up the entire function that it delegates to.
That doesn't mean it makes sense to extract part of a
function that wasn't written to be treated that way.
More information about the erlang-questions
mailing list