On 9/16/09, Frederic DUBOIS <fduboi...@gmail.com> wrote: > 2009/9/16 Uriel <lost.gob...@gmail.com>: >> On Wed, Sep 16, 2009 at 12:03 AM, frederic <fduboi...@gmail.com> wrote: >>> I'm pretty sure that if C featured closures, Anselm would cleverly use >>> them >>> and >>> make an even more simple, customizable and elegant dwm. >> >> I'm pretty sure that if C featured closures, Anselm and many others >> would promptly and cleverly hang themselves with them. >> > > This is slightly ambiguous. Do you mean: > - that they would hang themselves in despair? In that case, why do you think > so? > - that they would hang themselves by accident? In that case, you > consider that a dangerous features be offered. But then, I would argue > that pointers are as dangerous as closures. >
i'd argue that closures don't mix well with the c style of programming eg if you add closures then you'd need anonymous functions then you'd start writing in the functional style passing around functions then you'd need memory management to clean up the return values and arguments (so you can write print(sum(map(atoi, split(read(filename)))))) and of course exception handling as return values have different purpose, not to mention multiple return values and sometime polymorphism is required as well with a bit more powerful type system with possible runtime dispatch oh and don't forget about module systems... it seems to me that c is a fairly closed design with a simple mental model, pointers are dangerous but fit into this model closures would make it a bit more convoluted with little additional gain if you need closures then a new language design is needed and you'd probably end up with a lisp or ml like language which is not good for managing flat memory spaces but useful in other areas..