Hacker News new | past | comments | ask | show | jobs | submit login

No need to build this into a language. It can be provided as a simple library function:

    with<T>(resource : T, body : T => Void) where T <: Resource

    with(file, f => { ... })



Adding control semantics via library extensions seems to be a thing now. It has a bad history, though, from the extensible languages of the 1970s, when people first discovered that you could do fancy things with macros. That didn't end well.

You don't need many control constructs, and the list is pretty well known, so you may as well design them into the language.


Which is yet another reason for a modern language to handle generics.




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

Search: