Arc Forumnew | comments | leaders | submitlogin
Macro Patterns (plpatterns.com)
6 points by jonnytran 5764 days ago | 2 comments


3 points by Darmani 5762 days ago | link

Things like w/open-file, w/stdout, w/uniq, even perhaps aif and friends, I'd classify as "around code" rather than "resource management."The basic principle behind these is that we do some initialization (e.g.: opening a file), run some code, and then do some terminal work (e.g.: closing a file).

Ruby does similar things with blocks (c.f.: File#open), and I beleive Python has a specfic structure for this kind of thing.

-----

1 point by jonnytran 5759 days ago | link

Good point. "Around" is a concept used a lot in aspect-oriented programming. But I suspect that even fewer people are familiar with AOP or "around" than with macros or resource management.

-----