"David A. Black" <dblack / wobblini.net> schrieb im Newsbeitrag 
news:Pine.LNX.4.61.0501150344320.20765 / wobblini...
> Hi --
>
> On Sat, 15 Jan 2005, Robert Klemme wrote:
>
>>
>> "Mark Hubbart" <discordantus / gmail.com> schrieb im Newsbeitrag 
>> news:de63abca05011415224d4c29a1 / mail.gmail.com...
>>>
>>> My only argument against the shortcut syntax is that I can't see how
>>> often it could be used, except to simulate static typing. I suspect
>>> that adding a feature like this would encourage the use of static
>>> typing in methods.
>>
>> Ok, then we need a poll.  Or we should dig into Ruby's std lib to see how 
>> often these methods are called.
>
> Not very :-)  For 1.8.2:
>
> $ grep '\.to_str' `find . -name "*.rb"` | grep -v to_string | wc -l
>       6
> $ grep '\.to_int' `find . -name "*.rb"` | wc -l
>       1
>
> (It's around 700 for to_s and 300 for to_i.)

Here's my stat of ruby 1.8.2:

$ ruby -e 'Dir["**/*.{h,cC,rb,rw}"].inject(Hash.new(0)){|h,f| 
File.open(f){|io| io.each{|li| 
li.scan(/to_\w+/){|m|h[m]+=1}} };h}.sort.each{|k,v| print k," ",v,"\n"}'
to_a 193
to_above 2
to_access_path 1
to_addr 3
to_addrs 8
to_ajd 13
to_all 2
to_amjd 2
to_append 2
to_arry 5
to_ary 26
to_asn1integer 1
to_backslash 3
to_backslash_sequence 11
to_be_linked 1
to_below 2
to_bitmap 5
to_bn 1
to_bold 4
to_built_in_class 1
to_cache 4
to_check 5
to_civil 8
to_clean_up 6
to_clone 2
to_closest 2
to_commercial 4
to_consume 2
to_coords 2
to_d 6
to_date 2
to_day_fraction 3
to_dbl 2
to_dc_date 2
to_default 6
to_del 6
to_delete 2
to_der 51
to_der_if_possible 1
to_diff 3
to_digits 1
to_dir 4
to_directory_uri 2
to_e 2
to_enc 15
to_enclosed 2
to_euc_jp_from_iso_2022_jp 1
to_euc_jp_from_shift_jis 1
to_euc_jp_from_utf_8 1
to_eval 34
to_external 2
to_f 88
to_file 7
to_filename 5
to_find 3
to_flow 8
to_h 3
to_hash 21
to_hash_kv 8
to_html 5
to_i 541
to_ico 1
to_id 10
to_idx 2
to_indent_mode 4
to_index 4
to_int 3
to_internal 3
to_inum 2
to_io 10
to_iso_2022_jp_from_euc_jp 1
to_iso_8859_15 1
to_iso_8859_1_from_utf_8 1
to_jd 24
to_key 7
to_key_and_deref 1
to_label 2
to_latex 1
to_ld 2
to_level 6
to_line 1
to_lines 4
to_list 8
to_load 13
to_mailtext 3
to_mediator 12
to_mjd 2
to_name 6
to_new_year 2
to_newline 3
to_num 1
to_obj 26
to_oldpath 2
to_one 1
to_ordinal 5
to_overlapping 2
to_path 7
to_pem 9
to_pixel 6
to_png 3
to_pointer 5
to_proc 23
to_ptr 6
to_r 31
to_re 2
to_replace 4
to_rfc822text 1
to_rjd 1
to_router 5
to_rss 59
to_run 8
to_s 1379
to_s_09 1
to_s_10 1
to_s_20 1
to_s__ 2
to_s_table 2
to_s_with_iv 1
to_s_without_iv 1
to_search 2
to_set 9
to_shell 3
to_shift_jis_from_euc_jp 1
to_shift_jis_from_utf_8 1
to_src 2
to_str 32
to_string 27
to_sym 5
to_table 5
to_taskbar 2
to_text 7
to_time 9
to_time_t 1
to_uri 1
to_utc 4
to_utf 8
to_utf_8_from_euc_jp 1
to_utf_8_from_iso_8859_1 1
to_utf_8_from_shift_jis 1
to_version 5
to_wday 2
to_withtag 2
to_xml 4
to_xpath_helper 3
to_yaml 75
to_yaml_fold 3
to_yaml_properties 13
to_yaml_type 21

Sum 3143

Top counts

1379 to_s
541 to_i
193 to_a
88 to_f
75 to_yaml
59 to_rss
51 to_der
34 to_eval
32 to_str
31 to_r
27 to_string
26 to_ary
26 to_obj
24 to_jd
23 to_proc
21 to_hash
21 to_yaml_type

Kind regards

    robert