4 ms·
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 wi
by continuational 10y ago
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 => { ... })
- pjmlp 10y agoWhich is yet another reason for a modern language to handle generics.
- Animats 10y agoAdding 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.