[TxMt] Spreadsheets in Textmate

Charilaos Skiadas cskiadas at uchicago.edu
Mon Apr 24 12:43:20 UTC 2006

On Apr 24, 2006, at 3:55 AM, Sune Foldager wrote:

> On 24/04/2006, at 10:03, Domenico Carbotta wrote:
>> in python, you can create a class that redefines __getitem__,  
>> __setitem__ and __delitem__.
> Gotta love the nomenclature, too ;-:).
> In Ruby, [] at least, can be overridden without problems.

I don't exactly want to override it, I do want to call it eventually,  
just under some preliminary work. So I would have to probably alias  
it and then define a new []=, after creating an object-specific class  
for the array @rows (since I really need this change only for @rows).  
So I am guessing something like this, with more interesting  
implementations for [] and []=  :

class <<rows
   alias_method :orig, :[]
   alias_method :orig_eq, :[]=
   def [](row,col)
     return orig(row)
   def []=(row,col,value)

Heh, my first use for object-specific classes. Yey!

> -- Sune.


More information about the textmate mailing list