On Mon, 2005-07-25 at 20:10 -0500, Brian Hurt wrote: > > Note that languages encourage or discourage certain styles of programming. > For example, C++, and to a lesser extent Java and C#, rather strongly > discourages an applicative style of programming- primarily due to the > costs of allocation. You can do it, but it's going to be a fairly serious > perfomance hit. I agree with your assertion but not the reason you cite for it. The real reason it is discouraged is the lack of lexical scoping. I cite Felix as a counter example: the current implementation provides lexical scoping and functional programming in the ML style is simple and easy. Yet the stack frames are indeed allocated using malloc in the standard driver. For some classes of problems, the lack of performance here just isn't an issue -- especially as the optimiser eliminates almost all closures. [The real problem in Felix is the the collector cannot be run inside functional code, because there is no way to predict the structure of the machine stack: procedural code doesn't use the machine stack] -- John Skaller