Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The feature you really want for web-development is closures. I can't imagine writing event-handling code without them. As far as I know, Pascal does not have closures.

Unfortunately, with closures you need good memory handling. And this means either a complicated type-system such as Rust's, or a garbage collected environment. The way C++ does closures is too dangerous for event-driven code, imho.



I never need a closure. You need a shift in thinking, closures are much heavier than ordinary procedures, at least in Golang (yes, this is a real world experience).

Delphi has closures, FPC is on development, but in the end I won't use it much. I need performance and maintainability, closures are against those two.


> As far as I know, Pascal does not have closures.

They're called Anonymous Methods in Object Pascal:

http://docwiki.embarcadero.com/RADStudio/Berlin/en/Anonymous...

Free Pascal doesn't support them yet.


Why do you want closures for the web code? What do they add? What is hard to do without them?


To handle event call-backs. Generally, inside an event-handler, you want access to variables in a higher scope.


Two things:

1. You don't need closures at a language level to do event callbacks. Just the ability to refer to functions by reference and call those references. Closures certainly make it syntactically nicer, but you can work without them.

2. You don't need event callbacks in a webserver to make it performant. The memory/CPU overheads needed to make closures work are essentially identical to what's needed to make blocking threaded code work, as long as the threading is done in userspace and you have support for expanding stacks. Even if you don't have support for those niceties, modern kernels and hardware are perfectly capable of handling thousands of OS-level threads.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: