top | item 45419590

(no title)

doug-moen | 5 months ago

what ginger bill actually said was

> I’d argue that actual closures which are unified everywhere as a single procedure type with non-capturing procedure values require some form of automatic-memory-management. That does not necessarily garbage collection nor ARC, but it could be something akin to RAII. This is all still automatic and against the philosophy of Odin.

C++ doesn't have this feature either. A C++ closure does not have the same type as a regular C-style function with the same argument types and result type. The types of functions and closures are not unified.

And C++ does have RAII, which the author feels is a kind of automatic memory management and against the philosophy of Odin.

So C++ doesn't have the feature G.B. says is impossible. I don't know enough to comment on Ada.

discuss

order

tialaramex|5 months ago

What Bill wrote, on his own web site, about his own language is simply this:

> For closures to work correctly would require a form of automatic memory management which will never be implemented into Odin.

I suppose you can insist Bill thinks "correctly" means all that verbiage about unified types - but then a reasonable question would be why doesn't Odin provide these "not correct" closures people enjoy in other languages ?

RAII is entirely irrelevant, the disposal of a closure over a Goose is the same as disposal of a Goose value itself. In practice I expect a language like Odin would prefer to close over references, but again Odin is able to dispose of references so what's the problem?