<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>drawohara - Latest Comments in [Rails] limiting tmp/sessions to a maximum number of sessions files</title><link>http://drawohara.disqus.com/</link><description>drawohara rocks</description><language>en</language><lastBuildDate>Tue, 24 Jun 2008 10:15:44 -0000</lastBuildDate><item><title>Re: [Rails] limiting tmp/sessions to a maximum number of sessions files</title><link>http://drawohara.com/post/39090749#comment-737423</link><description>funny - the comment got eaten in the email response i sent (disqus let's you reply via email if you're logged in, etc)  anyhow, this is what i'd said:&lt;br&gt;&lt;br&gt;&lt;br&gt;yeah there are a few reasons&lt;br&gt;&lt;br&gt;1) if i used functions i'd have to pass info to each of them.  when i'm working up a short script it's sometime easier to make functions work 'over' data (closure style) since it allows me to play around with what the lambda's do without concern for data passing or signature design.  note how the lambdas affect the var 'n' as an example.&lt;br&gt;&lt;br&gt;2) def is ugly for short scripts.&lt;br&gt;&lt;br&gt;as a script like this matured i'd steer towards a class based approach since it allows the same functionality in a more 'normal' rubylike way of doing things: namely encapsulating the data functions work over as instance vars.  nevertheless if you imagine that script being wrapped in 'class Wrapper...' and the data the lambdas work on as @ivars you'll see that using closures in this way effectively makes the script an 'instance' of an object whose class is defined by the script itself.&lt;br&gt;&lt;br&gt;for example:&lt;br&gt;&lt;br&gt;  * encapsulation via objects&lt;br&gt;&lt;br&gt;&lt;code style='whitespace:pre'&gt;&lt;br&gt;    class Example&lt;br&gt;      def initialize&lt;br&gt;        @x = 40&lt;br&gt;      end&lt;br&gt;&lt;br&gt;      def inc!&lt;br&gt;        @x += 2&lt;br&gt;      end&lt;br&gt;    end&lt;br&gt;&lt;br&gt;    example = Example.new&lt;br&gt;&lt;br&gt;    example.inc!&lt;br&gt;&lt;/code&gt;&lt;br&gt;&lt;br&gt;  * encapsulation via closures&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;code style='whitespace:pre'&gt;&lt;br&gt;    #! /bin/bash&lt;br&gt;&lt;br&gt;    x = 40&lt;br&gt;    &lt;br&gt;    inc = lambda{ x += 2 }&lt;br&gt;&lt;br&gt;    inc.call&lt;br&gt;&lt;/code&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">drawohara</dc:creator><pubDate>Tue, 24 Jun 2008 10:15:44 -0000</pubDate></item><item><title>Re: [Rails] limiting tmp/sessions to a maximum number of sessions files</title><link>http://drawohara.com/post/39090749#comment-737083</link><description>himm, is that some sort of metaphorical answer i didn't get? =)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">s</dc:creator><pubDate>Tue, 24 Jun 2008 09:19:14 -0000</pubDate></item><item><title>Re: [Rails] limiting tmp/sessions to a maximum number of sessions files</title><link>http://drawohara.com/post/39090749#comment-730833</link><description></description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">drawohara</dc:creator><pubDate>Mon, 23 Jun 2008 11:50:06 -0000</pubDate></item><item><title>Re: [Rails] limiting tmp/sessions to a maximum number of sessions files</title><link>http://drawohara.com/post/39090749#comment-713507</link><description>is there a particular reason you used lambda instead of a method call?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">s</dc:creator><pubDate>Fri, 20 Jun 2008 05:25:18 -0000</pubDate></item></channel></rss>