From: MonkeeSage Date: 2007-12-28T02:54:58+09:00 Subject: Re: Add Array#first= and Array#last= to std lib On Dec 27, 9:55 am, Sebastian Hungerecker wrote: > George wrote: > > What would you expect this to do? > > > [].last = 1 > > The same thing as "[][-1] = 1", I'd imagine. > The problem I'm seeing would be this: If you allow arr.last = x, you'd also > have to allow arr.last(n) = x if you want to be consistent, but that's not > syntactically possible. > > -- > NP: Katatonia - Endtime > Jabber: sep...@jabber.org > ICQ: 205544826 Agree. It's tempting to treat #first / #last as 0 / -1, but in actuality they are method calls and simply return a value; they don't subscript an array. Setting #last is not semantically different than [1,2,3].pop = 4, it's just that #last is just a bit more subtle. Regards, Jordan