2 ms·
> it was just the natural thing to do in ruby, versus having to implement something specifically for the open-file case in lisp. Uh what? 1. File#open is a sp
by masklinn 12y ago
> it was just the natural thing to do in ruby, versus having to implement something specifically for the open-file case in lisp.
Uh what?
1. File#open is a special implementation, the canonical opening of a file is File#new
2. with-open-file is just a wrapper macro around unwind-protect/open/close
- zem 12y agoi meant that it's a natural thing to do in ruby to implement patterns like open/yield/close or decorate/sort/undecorate as methods that yield to a block. with-open-file was probably a bad example, but from experience it does change the feel of the language when you have to explicitly specify a closure argument versus when you just expect that your method should allow for a block to be attached to the method call. i'm not saying that these things aren't possible in other languages, just that ruby's "free" block makes them a culturally default thing to do.