Re: H with indifferent access

2009-01-24 Thread Eric Mill
I'm pretty indifferent about access.

On Sat, Jan 24, 2009 at 3:15 PM, Jenna Fox  wrote:
> Yes! give me indifferent access! :D
>
> On 25/01/2009, at 7:35 AM, Magnus Holm wrote:
>
> Doh, the snippet I wrote was actually really stupid. Forgot we can safely
> call super without thinking of recursive calls. What do you guys think? Is
> it worth it?
> Method access won't go away, and Mash was just an experiement; I don't want
> to add another dependency on Camping.
> //Magnus Holm
>
>
> On Sat, Jan 24, 2009 at 21:12, Jenna Fox  wrote:
>>
>> Yes, I want my method access too!..
>>
>> Perhaps it'd be extra worthy of the '2.0' if you also did something akin
>> to:
>>
>> def [](k);super(k.to_s);end
>> def []=(k,v);super(k.to_s,v);end
>>
>> it's some bytes, but I think it's worth it!
>>
>> What ever happened to Mash?
>>
>>
>> On 25/01/2009, at 1:50 AM, Aria Stewart wrote:
>>
>>> On Jan 24, 2009, at 7:24, zimbatm  wrote:
>>>
 Hi Magnus,

 I prefer using method_missing, with string access for fallback when
 key names are not compatible with ruby method names.
>>>
>>> And I prefer symbols, but it's a total edge case to me. Strings are great
>>> too, and it'd bug me less than indifference.
>>>
>>> Aria
>>> ___
>>> Camping-list mailing list
>>> Camping-list@rubyforge.org
>>> http://rubyforge.org/mailman/listinfo/camping-list
>>
>> ___
>> Camping-list mailing list
>> Camping-list@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/camping-list
>
> ___
> Camping-list mailing list
> Camping-list@rubyforge.org
> http://rubyforge.org/mailman/listinfo/camping-list
>
> ___
> Camping-list mailing list
> Camping-list@rubyforge.org
> http://rubyforge.org/mailman/listinfo/camping-list
>
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: H with indifferent access

2009-01-24 Thread Jenna Fox

Yes! give me indifferent access! :D


On 25/01/2009, at 7:35 AM, Magnus Holm wrote:

Doh, the snippet I wrote was actually really stupid. Forgot we can  
safely call super without thinking of recursive calls. What do you  
guys think? Is it worth it?


Method access won't go away, and Mash was just an experiement; I  
don't want to add another dependency on Camping.


//Magnus Holm


On Sat, Jan 24, 2009 at 21:12, Jenna Fox  
 wrote:

Yes, I want my method access too!..

Perhaps it'd be extra worthy of the '2.0' if you also did something  
akin to:


def [](k);super(k.to_s);end
def []=(k,v);super(k.to_s,v);end

it's some bytes, but I think it's worth it!

What ever happened to Mash?



On 25/01/2009, at 1:50 AM, Aria Stewart wrote:

On Jan 24, 2009, at 7:24, zimbatm  wrote:

Hi Magnus,

I prefer using method_missing, with string access for fallback when
key names are not compatible with ruby method names.

And I prefer symbols, but it's a total edge case to me. Strings are  
great too, and it'd bug me less than indifference.


Aria
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Re: H with indifferent access

2009-01-24 Thread Magnus Holm
Doh, the snippet I wrote was actually really stupid. Forgot we can safely
call super without thinking of recursive calls. What do you guys think? Is
it worth it?
Method access won't go away, and Mash was just an experiement; I don't want
to add another dependency on Camping.
//Magnus Holm


On Sat, Jan 24, 2009 at 21:12, Jenna Fox  wrote:

> Yes, I want my method access too!..
>
> Perhaps it'd be extra worthy of the '2.0' if you also did something akin
> to:
>
> def [](k);super(k.to_s);end
> def []=(k,v);super(k.to_s,v);end
>
> it's some bytes, but I think it's worth it!
>
> What ever happened to Mash?
>
>
>
> On 25/01/2009, at 1:50 AM, Aria Stewart wrote:
>
>  On Jan 24, 2009, at 7:24, zimbatm  wrote:
>>
>>  Hi Magnus,
>>>
>>> I prefer using method_missing, with string access for fallback when
>>> key names are not compatible with ruby method names.
>>>
>>
>> And I prefer symbols, but it's a total edge case to me. Strings are great
>> too, and it'd bug me less than indifference.
>>
>> Aria
>> ___
>> Camping-list mailing list
>> Camping-list@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/camping-list
>>
>
> ___
> Camping-list mailing list
> Camping-list@rubyforge.org
> http://rubyforge.org/mailman/listinfo/camping-list
>
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Re: H with indifferent access

2009-01-24 Thread Jenna Fox

Yes, I want my method access too!..

Perhaps it'd be extra worthy of the '2.0' if you also did something  
akin to:


def [](k);super(k.to_s);end
def []=(k,v);super(k.to_s,v);end

it's some bytes, but I think it's worth it!

What ever happened to Mash?


On 25/01/2009, at 1:50 AM, Aria Stewart wrote:


On Jan 24, 2009, at 7:24, zimbatm  wrote:


Hi Magnus,

I prefer using method_missing, with string access for fallback when
key names are not compatible with ruby method names.


And I prefer symbols, but it's a total edge case to me. Strings are  
great too, and it'd bug me less than indifference.


Aria
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: H with indifferent access

2009-01-24 Thread Aria Stewart

On Jan 24, 2009, at 7:24, zimbatm  wrote:


Hi Magnus,

I prefer using method_missing, with string access for fallback when
key names are not compatible with ruby method names.


And I prefer symbols, but it's a total edge case to me. Strings are  
great too, and it'd bug me less than indifference.


Aria
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


Re: H with indifferent access

2009-01-24 Thread zimbatm
Hi Magnus,

I prefer using method_missing, with string access for fallback when
key names are not compatible with ruby method names.
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


H with indifferent access

2009-01-24 Thread Magnus Holm
Camping::H hasn't longer indiffenrent access:
  h = Camping::H.new
  h.title = "Sweet!"
  h[:title] != h["title"]

Should we (1) don't make it indifferent at all, but rather say you should
always use method_missing (2) add indifferent access?

Here is one such implementation in 86 bytes, in case we want it:

  class H < Hash
i='def []!(k,v)Symbol===k ?self[k.to_s]!v:super end;'
eval i.tr('!','=')+i.tr('!,v','')
  end

//Magnus Holm
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list