[#26463] New Features for the Array Module — Daniel Cohen <danielc2017@...>
To Whom it May Concern:
[#26488] Add Standard Deviation Function to Math Module — Daniel Cohen <danielc2017@...>
This patch adds a Standard Deviation function to the Math Module. It takes
Hi,
OK,
Hi,
Matz,
Hi,
On Tue, Nov 3, 2009 at 16:56, Yusuke ENDOH <mame@tsg.ne.jp> wrote:
On Nov 3, 2009, at 8:28 PM, Cameron McBride wrote:
2009/11/4 Yusuke ENDOH <mame@tsg.ne.jp>:
[#26492] HashWithIndifferentAccess to core — Urabe Shyouhei <shyouhei@...>
Hello,
Hi,
On Tue, Nov 3, 2009 at 6:48 AM, Yukihiro Matsumoto <matz@ruby-lang.org> wro=
Just a thought: What about implementing this with an option on Hash:new,
Hi,
Hi,
2009/11/6 Yukihiro Matsumoto <matz@ruby-lang.org>:
Hi,
Hi,
I'm not sure that it really makes sense to add any of this to core.
On Sat, Nov 7, 2009 at 10:21 AM, Rick DeNatale <rick.denatale@gmail.com> wrote:
On Nov 7, 2009, at 1:57 PM, Jeremy Kemper wrote:
On Sat, Nov 7, 2009 at 3:14 PM, James Edward Gray II
Hi,
[#26497] [Bug #2326] 1.8.7 Segmentation fault — Johan Holmberg <redmine@...>
Bug #2326: 1.8.7 Segmentation fault
Issue #2326 has been updated by Hongli Lai.
[#26523] [Bug #2330] Non systematic segmentation fault with autoload rubyspec — Marc-Andre Lafortune <redmine@...>
Bug #2330: Non systematic segmentation fault with autoload rubyspec
Issue #2330 has been updated by Marc-Andre Lafortune.
Hi,
Argh... I can't reproduce my minimal case scenario anymore. Maybe
1) The minimal test case
Hi,
[#26540] [Bug #2336] pathname compare fails in windows — Roger Pack <redmine@...>
Bug #2336: pathname compare fails in windows
[#26560] [Feature #2340] Removing YAML/Syck — Yui NARUSE <redmine@...>
Feature #2340: Removing YAML/Syck
Issue #2340 has been updated by Yui NARUSE.
On Nov 6, 2009, at 4:02 AM, Yui NARUSE wrote:
> > Issue #2340 has been updated by Yui NARUSE.
Jon wrote:
> > If you're looking at alternatives, does http://pyyaml.org/wiki/LibYAML
On Sat, Nov 07, 2009 at 12:59:25AM +0900, NARUSE, Yui wrote:
Aaron Patterson wrote:
On Sat, Nov 07, 2009 at 09:21:06PM +0900, NARUSE, Yui wrote:
On Sat, Nov 7, 2009 at 2:52 PM, Aaron Patterson
2009/11/12 5:47, Charles Oliver Nutter wrote:
On Fri, Nov 6, 2009 at 16:00, James Edward Gray II
On Nov 6, 2009, at 9:48 AM, Nikolai Weibull wrote:
James Edward Gray II wrote:
On Fri, Nov 6, 2009 at 18:38, Joel VanderWerf <vjoel@path.berkeley.edu> wro=
Issue #2340 has been updated by Yui NARUSE.
[#26563] [Bug #2343] Timeout.timeout doesn't raise Timeout::Error by default — Hongli Lai <redmine@...>
Bug #2343: Timeout.timeout doesn't raise Timeout::Error by default
[#26623] Re: [ruby-cvs:32896] Ruby:r25678 (trunk): * ext/dl/cptr.c (rb_dlptr_s_malloc, rb_dlptr_initialize): adding — Tanaka Akira <akr@...>
In article <200911062250.nA6Mo69d010341@ci.ruby-lang.org>,
In article <87y6mhb180.fsf@fsij.org>,
On Thu, Nov 12, 2009 at 11:54:49AM +0900, Tanaka Akira wrote:
[#26632] [Feature #2347] Math::INFINITY — Marc-Andre Lafortune <redmine@...>
Feature #2347: Math::INFINITY
2009/11/9 Marc-Andre Lafortune <redmine@ruby-lang.org>:
[#26635] [Feature #2348] RBTree Should be Added to the Standard Library — James Gray <redmine@...>
Feature #2348: RBTree Should be Added to the Standard Library
Issue #2348 has been updated by James Gray.
Hi,
Hi,
Hi,
Yusuke ENDOH wrote:
2010/3/22 Bill Kelly <billk@cts.com>:
[#26650] [Feature #2350] Unicode specific functionality on String in 1.9 — Manfred Stienstra <redmine@...>
Feature #2350: Unicode specific functionality on String in 1.9
Issue #2350 has been updated by Yusuke Endoh.
On Thu, Mar 25, 2010 at 14:45, Yusuke Endoh <redmine@ruby-lang.org> wrote:
(2010/03/26 0:02), Nikolai Weibull wrote:
On Thu, Mar 25, 2010 at 18:24, NARUSE, Yui <naruse@airemix.jp> wrote:
On Thu, Mar 25, 2010 at 19:33, Nikolai Weibull <now@bitwi.se> wrote:
The problem is that the definition of #upcase doesn't only depend on the
On Fri, Mar 18, 2011 at 11:53, Magnus Holm <judofyr@gmail.com> wrote:
[#26652] [Bug #2351] system() hardlinked to /bin/sh — Marcus Franke <redmine@...>
Bug #2351: system() hardlinked to /bin/sh
Issue #2351 has been updated by Motohiro KOSAKI.
[#26668] [Bug #2353] hash.c:setenv causes crashes in Solaris — Christian Höltje <redmine@...>
Bug #2353: hash.c:setenv causes crashes in Solaris
[#26704] Maintainer confirmation process done. — "Yugui (Yuki Sonoda)" <yugui@...>
I'm sorry for my closing the maintainer confirmation process so late.
On Thu, Nov 12, 2009 at 05:29:55PM +0900, Yugui (Yuki Sonoda) wrote:
Aaron Patterson wrote:
[#26722] [Bug #2362] undefined variable has value? — Vit Ondruch <redmine@...>
Bug #2362: undefined variable has value?
[#26735] warnings on build — Roger Pack <rogerdpack@...>
As an FYI, I get these at compile time:
[#26736] [Bug #2365] Matrix: poor handling of coercion errors [patch] — Marc-Andre Lafortune <redmine@...>
Bug #2365: Matrix: poor handling of coercion errors [patch]
Issue #2365 has been updated by Marc-Andre Lafortune.
Hi,
Hi,
[#26745] [Bug #2371] [BUG] thread_free: locking _mutex must be NULL — Chris Schlaeger <redmine@...>
Bug #2371: [BUG] thread_free: locking _mutex must be NULL
[#26753] (send #2) cgi.rb cleanup — Ryan Davis <ryand-ruby@...>
(not sure why my previous email about this got dropped)
Hi,
[#26767] [Bug #2376] Kernel.__method__ rubyspec failures for 1.8.* — Vladimir Sizikov <redmine@...>
Bug #2376: Kernel.__method__ rubyspec failures for 1.8.*
[#26771] [Bug #2377] update documentation for IO#eof? — Roger Pack <redmine@...>
Bug #2377: update documentation for IO#eof?
[#26772] [Bug #2378] Regression in ParseDate.parsedate('nn-nn') — Vladimir Sizikov <redmine@...>
Bug #2378: Regression in ParseDate.parsedate('nn-nn')
Issue #2378 has been updated by Hiro Asari.
[#26774] Ruby constant lookup — Yehuda Katz <wycats@...>
Over the past six months or so, I have been working with the new Ruby 1.9
Hi,
Shugo,
Hi,
On Tue, Nov 17, 2009 at 1:29 AM, Shugo Maeda <shugo@ruby-lang.org> wrote:
Hi,
On Sun, Nov 22, 2009 at 8:08 PM, Shugo Maeda <shugo@ruby-lang.org> wrote:
On Mon, Nov 23, 2009 at 8:08 AM, Rick DeNatale <rick.denatale@gmail.com> wr=
Hi,
Shugo,
[#26788] [Bug #2380] IO#eof? behavior different with 1.9.1p243-mingw32 than other platforms — Ian Dees <redmine@...>
Bug #2380: IO#eof? behavior different with 1.9.1p243-mingw32 than other platforms
Issue #2380 has been updated by Vit Ondruch.
[#26837] [Bug #2389] REXML rails to format parsed SVGs created with inkscape — Alexey Froloff <redmine@...>
Bug #2389: REXML rails to format parsed SVGs created with inkscape
[#26852] Internals: #to_s .vs. #to_str? — Kurt Stephens <ks@...>
Is there a description of the semantic differences between #to_s and
[#26868] [Bug #2392] "Date.valid_civil?" issue in p383 — Ozgun Koyun <redmine@...>
Bug #2392: "Date.valid_civil?" issue in p383
[#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
> =A0It reduces the number of #to_s Strings created during the MRI test sui=
The attached patch add caching of #to_s results to the main immutable
> Yes. =A0The MRI test suite runs at 45 sec with these changes and at 53 se=
I just ran rubyspec against it; ~ 5% time improvement.
Attached is a new version of the patch.
Hi,
On Tue, Dec 1, 2009 at 18:19, Yusuke ENDOH <mame@tsg.ne.jp> wrote:
Nikolai Weibull wrote:
[#26877] [Bug #2394] [BUG] pthread_mutex_lock: 22 revisited — Roger Pack <redmine@...>
Bug #2394: [BUG] pthread_mutex_lock: 22 revisited
[#26889] email from redmine — danielcavanagh@...
hi
[#26931] Re: something broke ruby floats — Ryan Davis <ryand-ruby@...>
CC'ing ruby-core@
[#26939] Methods with default params not at the end and with rest params — Vladimir Sizikov <vsizikov@...>
Hi,
Hi,
Hi Matz,
[#26943] [Bug #2412] CSV regression after revision 25952 — Alexey Froloff <redmine@...>
Bug #2412: CSV regression after revision 25952
[ruby-core:26611] Re: HashWithIndifferentAccess to core
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
>