[#26488] Add Standard Deviation Function to Math Module — Daniel Cohen <danielc2017@...>

This patch adds a Standard Deviation function to the Math Module. It takes

25 messages 2009/11/02
[#26489] Re: Add Standard Deviation Function to Math Module — Yukihiro Matsumoto <matz@...> 2009/11/03

Hi,

[#26490] Re: Add Standard Deviation Function to Math Module — Daniel Cohen <danielc2017@...> 2009/11/03

OK,

[#26493] Re: Add Standard Deviation Function to Math Module — Yukihiro Matsumoto <matz@...> 2009/11/03

Hi,

[#26511] Re: Add Standard Deviation Function to Math Module — Yusuke ENDOH <mame@...> 2009/11/03

Hi,

[#26492] HashWithIndifferentAccess to core — Urabe Shyouhei <shyouhei@...>

Hello,

35 messages 2009/11/03
[#26496] Re: HashWithIndifferentAccess to core — Yukihiro Matsumoto <matz@...> 2009/11/03

Hi,

[#26507] Re: HashWithIndifferentAccess to core — Jeremy Kemper <jeremy@...> 2009/11/03

On Tue, Nov 3, 2009 at 6:48 AM, Yukihiro Matsumoto <matz@ruby-lang.org> wro=

[#26514] Re: HashWithIndifferentAccess to core — "Martin J. Dst" <duerst@...> 2009/11/04

Just a thought: What about implementing this with an option on Hash:new,

[#26522] Re: HashWithIndifferentAccess to core — Yusuke ENDOH <mame@...> 2009/11/04

Hi,

[#26555] Re: HashWithIndifferentAccess to core — Yukihiro Matsumoto <matz@...> 2009/11/05

Hi,

[#26584] Re: HashWithIndifferentAccess to core — Yugui <yugui@...> 2009/11/07

2009/11/6 Yukihiro Matsumoto <matz@ruby-lang.org>:

[#26589] Re: HashWithIndifferentAccess to core — Yukihiro Matsumoto <matz@...> 2009/11/07

Hi,

[#26593] Re: HashWithIndifferentAccess to core — Lourens Naud<lourens@...> 2009/11/07

Hi,

[#26523] [Bug #2330] Non systematic segmentation fault with autoload rubyspec — Marc-Andre Lafortune <redmine@...>

Bug #2330: Non systematic segmentation fault with autoload rubyspec

12 messages 2009/11/04

[#26560] [Feature #2340] Removing YAML/Syck — Yui NARUSE <redmine@...>

Feature #2340: Removing YAML/Syck

38 messages 2009/11/06
[#26562] [Feature #2340] Removing YAML/Syck — Yui NARUSE <redmine@...> 2009/11/06

Issue #2340 has been updated by Yui NARUSE.

[#26567] Re: [Feature #2340] Removing YAML/Syck — James Edward Gray II <james@...> 2009/11/06

On Nov 6, 2009, at 4:02 AM, Yui NARUSE wrote:

[#26568] Re: [Feature #2340] Removing YAML/Syck — Jon <jon.forums@...> 2009/11/06

> > Issue #2340 has been updated by Yui NARUSE.

[#26571] Re: [Feature #2340] Removing YAML/Syck — "NARUSE, Yui" <naruse@...> 2009/11/06

Jon wrote:

[#26574] Re: [Feature #2340] Removing YAML/Syck — Aaron Patterson <aaron@...> 2009/11/06

On Sat, Nov 07, 2009 at 12:59:25AM +0900, NARUSE, Yui wrote:

[#26635] [Feature #2348] RBTree Should be Added to the Standard Library — James Gray <redmine@...>

Feature #2348: RBTree Should be Added to the Standard Library

20 messages 2009/11/08
[#28842] [Feature #2348] RBTree Should be Added to the Standard Library — James Gray <redmine@...> 2010/03/21

Issue #2348 has been updated by James Gray.

[#26650] [Feature #2350] Unicode specific functionality on String in 1.9 — Manfred Stienstra <redmine@...>

Feature #2350: Unicode specific functionality on String in 1.9

12 messages 2009/11/09
[#28985] [Feature #2350](Rejected) Unicode specific functionality on String in 1.9 — Yusuke Endoh <redmine@...> 2010/03/25

Issue #2350 has been updated by Yusuke Endoh.

[#28993] Re: [Feature #2350](Rejected) Unicode specific functionality on String in 1.9 — Nikolai Weibull <now@...> 2010/03/25

On Thu, Mar 25, 2010 at 14:45, Yusuke Endoh <redmine@ruby-lang.org> wrote:

[#26704] Maintainer confirmation process done. — "Yugui (Yuki Sonoda)" <yugui@...>

I'm sorry for my closing the maintainer confirmation process so late.

13 messages 2009/11/12

[#26736] [Bug #2365] Matrix: poor handling of coercion errors [patch] — Marc-Andre Lafortune <redmine@...>

Bug #2365: Matrix: poor handling of coercion errors [patch]

12 messages 2009/11/14

[#26772] [Bug #2378] Regression in ParseDate.parsedate('nn-nn') — Vladimir Sizikov <redmine@...>

Bug #2378: Regression in ParseDate.parsedate('nn-nn')

10 messages 2009/11/16

[#26774] Ruby constant lookup — Yehuda Katz <wycats@...>

Over the past six months or so, I have been working with the new Ruby 1.9

22 messages 2009/11/16
[#26775] Re: Ruby constant lookup — Shugo Maeda <shugo@...> 2009/11/17

Hi,

[#26777] Re: Ruby constant lookup — Yehuda Katz <wycats@...> 2009/11/17

Shugo,

[#26778] Re: Ruby constant lookup — Shugo Maeda <shugo@...> 2009/11/17

Hi,

[#26869] Caching #to_s for immutables (and a possible future for constant-folding) — Kurt Stephens <ks@...>

I have a proof-of-concept patch to MRI that caches #to_s values for

16 messages 2009/11/23
[#26936] Re: Caching #to_s for immutables (and a possible future for constant-folding) — Roger Pack <rogerdpack@...> 2009/11/29

> =A0It reduces the number of #to_s Strings created during the MRI test sui=

[#26958] Re: Caching #to_s for immutables (and a possible future for constant-folding) [with patch] — Kurt Stephens <ks@...> 2009/11/30

The attached patch add caching of #to_s results to the main immutable

[#26960] Re: Caching #to_s for immutables (and a possible future for constant-folding) [with patch] — Roger Pack <rogerdpack@...> 2009/11/30

> Yes. =A0The MRI test suite runs at 45 sec with these changes and at 53 se=

[#26963] Re: Caching #to_s for immutables (and a possible future for constant-folding) [with patch] — Kurt Stephens <ks@...> 2009/11/30

I just ran rubyspec against it; ~ 5% time improvement.

[ruby-core:26611] Re: HashWithIndifferentAccess to core

From: Lourens Naud<lourens@...>
Date: 2009-11-08 02:31:35 UTC
List: ruby-core #26611
Rick,

Good points - however just overriding eg. Hash#[], Hash#[]= &&  
Hash#key? also usually
implies having to alias related methods to the new implementation as a  
result of their definition referencing
the original method by default :

     rb_define_method(rb_cHash,"include?", rb_hash_has_key, 1);
     rb_define_method(rb_cHash,"member?", rb_hash_has_key, 1);
     rb_define_method(rb_cHash,"has_key?", rb_hash_has_key, 1);
     rb_define_method(rb_cHash,"has_value?", rb_hash_has_value, 1);
     rb_define_method(rb_cHash,"key?", rb_hash_has_key, 1);
     rb_define_method(rb_cHash,"value?", rb_hash_has_value, 1);

An example from ActiveSupport :

     # Checks the hash for a key matching the argument passed in:
     #
     #   hash = HashWithIndifferentAccess.new
     #   hash["key"] = "value"
     #   hash.key? :key  # => true
     #   hash.key? "key" # => true
     #
     def key?(key)
       super(convert_key(key))
     end

     alias_method :include?, :key?
     alias_method :has_key?, :key?
     alias_method :member?, :key?

I recall having spent some dead time in the past being either bitten  
by this on my own projects or using some gems / frameworks that went  
down this road
and exclusively tested against the API style of the author(s) eg. key?  
VS has_key? etc.

 From a library / framework perspective, missing an alias is usually  
very dangerous as you can't assume a usage style and need to support  
all of the current
Hash API in order to be compliant.

Perhaps a unified sub project, much like rack would be a good start -  
released as a gem.The hwia gem implementation was just a proof
of concept, but I found having to duplicate a lot of core hash methods  
for not being exposed via intern.h somewhat of a pain, in addition to  
supporting both
mainline ruby versions.Having more methods exposed via intern.h would  
help quite a bit with a lean gem implementation.

Exposing the hashing API to library authors also removes the  
dependencies of having to subclass methods and restoring method  
aliases - adhere to
a well defined contract ( #hash(a), #compare(a,b) or whatever it may  
be, or whatever such a scheme may be called ) and the expected  
interfaces and behavior
holds for the core Hash API.

Thoughts ?

- Lourens

On 2009/11/07, at 18:21, Rick DeNatale wrote:

> I'm not sure that it really makes sense to add any of this to core.
>
> So far the argument goes something like this.
>
> Several important ruby based web frameworks have some form of
> HashWithIndifferentAccess class, Rails, Merb and Sinatra have been
> mentioned. Did I miss any?
>
> Since it seems to be a common use case, perhaps it should be in Ruby  
> core.
>
> And implementations have been given which either:
>
>    store keys in the hash which are the same type as that given as
> the key parameter to WhateverTheHeckWeCallThisThing#[]=
>   convert the key to a symbol if it's a string
>   convert the key to a string if it's a symbol.
>
> Then the arguments start over what to name it.
>
>
> So I've just now looked at Merb, Rails and Sinatra to see what's up.
>
> The ONLY difference between Merb and Rails here, as far as I can tell
> is the name of WhateverTheHeckWeCallThisThing.  Rails (actually
> ActiveSupport) calls it HashWithIndifferent access, Merb (actually the
> extlib gem) calls it Mash. Other than the name the code appears to be
> identical, including the initial comment:
>
> # This class has dubious semantics and we only have it so that
> # people can write params[:key] instead of params['key']
> # and they get the same value for both keys.
>
> And what is the implementation? Basically it
>
>   1) overrides the initialize method to convert its keys to strings
> after being initialized if the parameter to new is a hash.
>
>   2) overrides Hash#default(key=nil) to efffectively return
> self[key.to_s] if the key arg is a symbol and key.to_s is included in
> the hash.
>
>   3) overrides Hash#[]=(key,value) to effectively call
>         super[convert_key(key)] = convert_value(value)
>       where convert_key changes symbols to strings and leaves any
> other key alone
>       and convert_value converts an ordinary hash value to a
> HashWithIndifferentAccess/Mash and leaves anything else alone.  This
> is because one of the main uses of this thing is for nested parameters
> in a http request.
>
>    4) overrides any other method which takes a key argument to call
> convert_key on it before using it.
>
> Sinatra, is much more minimal, as one might expect.  It doesn't have
> such a class, rather it defines a  Sinatra::Base#indifferent_hash
> method
>
>    def indifferent_hash
>      Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
>    end
>
> Which simply makes
>
>   indifferent_hash[:a]
> return the same value as
>  indifferent_hash['a']
> if :a isn't a key in the hash.
>
> Sinatra apparently relies on the code which uses these hashes not to
> use both a symbol and it's string form together for []=
>
>
> Personally I think that as implemented in both Rails/Merb and Sinatra,
> this is much ado about nothing, It wouldn't really buy much to pull
> this code down to core whatever you name it, and if something with
> different semantics, such as some of the proposals on this thread was
> adopted, it's likely that the frameworks, would ignore it, unless it
> were given a name which clashed.
>
> As for the decision made by all three of these frameworks to
> consistenly use strings rather than symbols for this, I think it makes
> sense.   When I first realized that HashWIthIndifferentAccess did it
> this way it didn't make sense to me, since I perceived the motivation
> to be performance and one a symbol was interned looking up symbol keys
> should be faster since Symbol#hash is O(1), and String#hash is
> O(string.length).
>
> But doing it the other way, and using Symbols rather than Strings for
> the actual, stored, keys in the hash has a time and space cost,
> because every time a String is used as a key in a method, it must be
> converted to a Symbol, which requires the equivalent of looking it up
> to see if it has already been interned, and making a copy non-gcable.
>
> And taking a laissez-faire approach and storing either strings or
> symbols and trying to make them come out the same when the Hash is
> accessed, would seem to require additional overhead for each lookup,
> as well as introducing ambiguities of specification if both :key and
> 'key' were used to store in the hash, as I pointed out earlier in this
> thread.
>
> To summarize, I'd vote for leaving things in core as they are, and
> letting frameworks implement such extensions the way they see fit.
> -- 
> Rick DeNatale
>
> Blog: http://talklikeaduck.denhaven2.com/
> Twitter: http://twitter.com/RickDeNatale
> WWR: http://www.workingwithrails.com/person/9021-rick-denatale
> LinkedIn: http://www.linkedin.com/in/rickdenatale
>


In This Thread