User loginNavigation |
Higher-Order Programming without Closures?The connections between higher-order functions and closures have been discussed here before, and clearly closures make higher-order programming more expressive. However, closures can sometimes make reasoning about space use and efficiency more difficult, as they penalize all higher-order function call sites (absent whole-program compilation). I wonder if anyone has explored the space of languages with higher-order functions, but without closures. By this I mean that all functions-as-values are restricted to carry no environment, thus reducing them to C-like function pointers. We can add closures back using modules: module type Fun = sig type ('a,'b) t val new: ('a -> 'b) -> ('a,'b) t val apply: ('a,'b) t -> 'a -> 'b end So it's clear from function signatures whether an operation accept a Fun or accepts a function pointer. The space use and efficiency trade-offs are thus quite clear. I don't have a good intuition as to how painful this might be to program with however. Eliminating closures clearly decreases expressiveness, but if we keep an expressive ML-like syntax with type inference, we haven't quite devolved to Java-like verbosity. Have any languages taken this or a similar route? By naasking at 2008-03-15 17:33 | LtU Forum | previous forum topic | next forum topic | other blogs | 11327 reads
|
Browse archives
Active forum topics |
Recent comments
22 weeks 6 days ago
22 weeks 6 days ago
22 weeks 6 days ago
45 weeks 14 hours ago
49 weeks 2 days ago
50 weeks 6 days ago
50 weeks 6 days ago
1 year 1 week ago
1 year 6 weeks ago
1 year 6 weeks ago