Tracy R Reed wrote:
Andrew Lentvorski wrote:
Functional progrmming doesn't need a cheerleader. It needs a problem to which it is an actual solution.

It seems Erlang was the right choice for Ericsson's phone switches. And for jabberd. I think Lisp was the right choice for emacs. And as the number of cores grow in our cpu's I think we will find many more problems to which functional programming is an actual solution. Can you do hot swapping of code in any non-functional language? The paralellism just seems to fall out nicely when using a side-effect free language as well.


Hot swapped code? Sure, it's trivial. Here's a snippet from FreePascal:

MyObject.SomeProcedure := @SomeOtherProcedure;

This replaces the procedure that was originally associated with the object MyObject with the replacement procedure SomeOtherProcedure. It does this by just swapping out pointers in the virtual method table. The only restriction is that it has to have the same signature (type and order of parameters). Because of this, you can store a bunch of routines in a shared object (*.so) and use dlload to provide the binding. Your program still calls MyObject.SomeProcedure but you can get totally different code execution depending on what you bind to the procedure call.

You can even store entire classes in a shared object and dynamically load/unload them, so it's feasible to have a same-named class do different things depending on where you got it from. This could be very useful where you want "business rules"[1] customized to each customer but want all the calling conventions to remain the same.

Gus

[1] I use this term only in the sense that there are no polite words to describe the steaming pile of dung that some people think is logic.

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to