News for hackers. Stuff that matters.
Re:Convincing Programmers They Want To Use Lisp by CJefferson on Monday February 21, 2011 @04:10PM (#2247197)
This "thing that can't be done in any other language" looks an awful lot like RAII in C++.

For example I can write:

  {
    ifstream file("filename");
    ...
  } // file closed here automatically.
or

  {
    mutex_grab g(mutex);
    .....
  } // mutex automatically released here
Re:Convincing Programmers They Want To Use Lisp by stcredzero on Monday February 21, 2011 @04:44PM (#2247338)
In Smalltalk, it's just a normal function you can add to Filename:

    doWithStreamThenClose: aBlock 
        | fileStream |
        fileStream := self newReadWriteStream.
        ^[aBlock value: fileStream]
            ensure: [fileStream close]
This allows one to do:

    (Filename named: 'mypath/foo.dat')
        doWithStreamThenClose: [ :fileStream |
             "do whatever you want with fileStream"
             "it shall be closed"
        ].