1651-1905

1419-1650 subjects 1836-2120

A min/max bug?
1651 [chr_news@gm ] the block version of Enumerable#max (or min) always
+ 1652 [matz@ru y- a] That's weird.  Mine gives
| 1654 [ser@ge ma e-] Or, put another way, grouping.  Ruby is parsing this as
| 1655 [matz@ru y- a] I don't think so.  Since "nil" ("p" return value) does not have "min"
| 1656 [ser@ge ma e-] Right.  That's why you (and I) are getting exceptions; I don't know why he was
| 1657 [chr_news@gm ] I am getting nil because I was compiling with the /Og + /Ot
+ 1653 [chr_news@gm ] Okay sorry this seems to be an artifact of an overly

Re: 1.8.1 preview2 (was: Re: 1.8.1 failure)
1658 [sunshine@su ] Is there any possibility of having the NextStep / OpenStep / Rhapsody
+ 1659 [matz@ru y- a] It's quite possible.  I'm going to take time to confirm your patch
+ 1660 [ryand@ze sp ] I meant to reply eventually to your original post... I never got my

ruby gc_sweep(): unknown data type
1661 [rich@in oe h] I have a problem that is a bit hard to express.
1662 [nobu.nokada@] Can't you try with more recent version Ruby?  It may be an
1663 [rich@in oe h] I will try a more recent version...just built 1.8.1 and will deploy and

Class variable and singleton problem
1664 [mark.wassell] class A
1665 [matz@ru y- a] Class variables belongs to surrounding class (or module), so that @@x
1666 [george.marro] Any chance you could explain the rationale for this in a bit more detail? I
+ 1667 [matz@ru y- a] Class variables look up follows the inheritance hierarchy starting
+ 1668 [decoux@mo lo] If I've well understood
  1669 [decoux@mo lo] gsub!(/@@meth/, '@@x') # sorry,
  1670 [george.marro] Matz --
  + 1671 [matz@ru y- a] Consider @@var as global variable with limited scope in the
  + 1672 [chr_news@gm ] You can find an example on why this probably a good idea  in
    1673 [george.marro] Thanks Christoph, the tests (test_variable.rb) help a lot. I guess the main

open-uri patch, added progress_proc hook
1674 [transami@ru ] i have made a small modification to open-uri to allow it to execute a proc in the data fetching loops. this has proved very useful to me in providing a progress reported download. (i used Ruby/ProgressBar). Note that in the future it might be nice to get open-uri to work more like a real IO.
1675 [akr@m1 n. rg] I don't like the API.
1676 [transami@ru ] i had it this way at first! :) but then i realized that it is dependent on special symbol :progress_proc -or- it must determine based on value class Proc but then what do you do with more than one Proc is in hash? plus the keys are meaningless then too. so i think it is better as an independent argument. it is an optional argument. so there is no backward compatability problems.
1677 [akr@m1 n. rg] * process content fragments instead of byte count.
1679 [transami@ru ] open( url, { pos: proc { |b| ...} } )  # would pass #pos
1680 [akr@m1 n. rg] No.  I already implemented.  (not committed yet.)
1681 [transami@ru ] could you show example? hmm...wouldn't the expected length be in the proc already if it were needed? that's what i did with my progressbar.
1682 [akr@m1 n. rg] % ruby -rlib/open-uri -e 'open("http://www.ruby-lang.org/en/",:progress_proc => lambda {|pos, total| p [pos, total]})'
1683 [transami@ru ] nice! that works for me. i was not thinking that the the total was provided (duh!)
1684 [akr@m1 n. rg] I don't like that.
1685 [transami@ru ] hmm...there may be noting to do about it. just have to live with it.
+ 1686 [ehughes@bl e] This doesn't seem like a good API. There are just too many
| 1688 [akr@m1 n. rg] Do you mean that we need some layer between open-uri and net/http?
| 1689 [transami@ru ] given everything you've pointed out some shortcoimings ay be unavoidable if it is to be very simple.
| 1690 [ehughes@bl e] In effect. I mean that if a method's interface is getting too complicated,
| + 1691 [ehughes@bl e] No, I definitely wouldn't trade an overly-complex method signature for an
| | 1692 [transami@ru ] class OpenURI::ProgessProc
| | + 1694 [ehughes@bl e] Closer, but not quite (*). I wasn't think of having a context object to
| | + 1697 [chr_news@gm ] Maybe this is kind of silly but a class name ``OpenURI::ProgessProc''
| + 1695 [akr@m1 n. rg] open("http://...", OpenURI::OptProgressProc => lambda {|s| ... })
|   1696 [batsman.geo@] What about
|   1698 [akr@m1 n. rg] What's an advantage over mine?
|   1700 [batsman.geo@] IMHO
|   1704 [akr@m1 n. rg] Since open-uri is a delegator to open any kind of URIs and other
|   1705 [ehughes@bl e] [the trouble with YAGNI is that -- if you're writing a library -- YAreGNI,
|   + 1708 [transami@ru ] This looks very good. Do you think commit will come soon?
|   | 1710 [akr@m1 n. rg] I don't decided the interface yet.
|   | 1711 [transami@ru ] okay.
|   | + 1712 [akr@m1 n. rg] I forgot to mention high level interface tends to have high overheads.
|   | | 1716 [transami@ru ] i had idea: maybe have sepereate method to ask just for header info, and this method could also get total size and time it took fetch header.  you said ftp needed a seperate fetch to get total anyway right? add one for http too. that way people can test connections which is good, and get useful information. and perhaps sometimes all they want is header. so you could kill two birds with one stone. actually three bird! :) does that make sense?
|   | | + 1717 [transami@ru ] _why! you are a a genius! i read your page, plain brilliance. i think once
|   | | | 1718 [ehughes@bl e] isn't this just odd for oddness' sake?
|   | | | 1722 [akr@m1 n. rg] I think more essential problem with URI's singleton method is redirection.
|   | | | 1724 [transami@ru ] opts = OpenUriOptions.new
|   | | | 1726 [akr@m1 n. rg] opts = OpenUriOptions.new
|   | | | 1731 [transami@ru ] It's actually kind of mind boggling just how nearly identical these two code
|   | | | 1732 [akr@m1 n. rg] As Elliott pointed out, it has a problem with typo detection.
|   | | | 1733 [transami@ru ] I don't see how this is a big deal. When I first read this on Elliots post I
|   | | | 1750 [akr@m1 n. rg] I see.  You don't care typos.  But I care typos.
|   | | | + 1752 [transami@ru ] I would not say I don't care. I just mean that for me it is not a "shop
|   | | | + 1759 [ser@ge ma e-] I hope I'm soon enough to dissuade you from this course of action.  I used
|   | | |   1762 [nathaniel@ta] What would you use in REXML if you had it to do over again? Will you
|   | | |   1766 [ser@ge ma e-] I don't know, and yes.
|   | | |   + 1773 [akr@m1 n. rg] How it confuse you and REXML user?
|   | | |   | 1783 [ser@ge ma e-] The "secret" keys aren't clearly defined in the API.  IE, you don't have a
|   | | |   | 1789 [akr@m1 n. rg] Isn't it documented?
|   | | |   | 1811 [ser@ge ma e-] Yes, and as we all know, the documentation is *always* kept up to date.
|   | | |   | 1871 [akr@m1 n. rg] Good.
|   | | |   | 1877 [ser@ge ma e-] What were your search terms?  Try searching for "whitespace" or "raw".  Those
|   | | |   | 1905 [akr@m1 n. rg] I searched "=>".
|   | | |   + 1776 [transami@ru ] If such arguments will become named parameters in the future, then it is
|   | | |   + 1788 [transami@ru ] While not suited to data parameters, when passing blocks I still find the idea
|   | | + 1723 [akr@m1 n. rg] I rethought about measuring speed of connection.
|   | |   1725 [transami@ru ] Wouldn't that download the whole file?
|   | |   1727 [akr@m1 n. rg] Use :progress_proc you suggested.
|   | + 1737 [matju@sy pa ] I'm puzzled by how this new behaviour would make anything actually easier
|   |   + 1738 [transami@ru ] Actually I agree. I don't know why Matz thinks this is the "most regrettable
|   |   | 1745 [matju@sy pa ] The idea of assigning to a variable a value that won't be used is
|   |   | 1747 [transami@ru ] I'm just not going to top that. She's one for the books!]
|   |   | 1798 [matju@sy pa ] I don't have an assignment-centric view of that. I tend to organize all my
|   |   + 1739 [matju@sy pa ] Actually, looking at http://www.rubygarden.org/ruby?Rite, I can only see a
|   |     1740 [transami@ru ] Lets clear this up, b/c i've read that too, and became very confused for a
|   |     1741 [matju@sy pa ] The current policy on the value of i is that i doesn't exist in the
|   |     + 1742 [transami@ru ] In the current system, yes, but I was demonstrating the new proposed system,
|   |     | 1746 [matju@sy pa ] what's the difference between a lambda/proc and a block?
|   |     | 1749 [transami@ru ] That was the very first thing that I did not understood about Ruby, and still
|   |     | 1792 [matju@sy pa ] * receiver (optional, defaults to self)
|   |     | + 1793 [matju@sy pa ] Further comment: on page 14 of Pickaxe, the footnote claims that Ruby's
|   |     | + 1794 [transami@ru ] Thanks Mathieu. That clears things up very nicely.
|   |     + 1748 [matz@ru y- a] I'm not going to abandon "real" closure.
|   + 1709 [akr@m1 n. rg] I feel no problem with lambda.
+ 1687 [akr@m1 n. rg] It's user's choice.  I don't want to deny progress bar for empty file.

Small change to lib/thread.rb to aid rdoc
1678 [gsinclair@so] May I commit this change?
1693 [gsinclair@so] No objections?  Done.

FileUtils bug and fix
1699 [chad@ch df w] As posted in ruby-talk:85349, I believe there is a bug in FileUtils.cp's
1701 [g@in er ec -] Would this be better done in copy_file()?  (There's also a small typo in
1702 [chad@ch df w] # Alternatively same src/dest could be checked for in fu_each_dest_src, so
1703 [aamine@lo er] Thank you for your report.

gc_sweep in Ruby 1.8
1706 [rich@in oe h] I posted about this before but Matz wanted me to post more detail.
1713 [decoux@mo lo] Well, the problem is here
1715 [rich@in oe h] Thanks Guy!

[patch] Small additions to Curses extension
1707 [vaine@cs he ] - def_prog_mode() as Curses.def_prog_mode

[patch] CGI multipart fails since StringIO#path returns nil
1714 [d.borodaenko] Since StringIO#path now returns nil, #local_path definition in cgi.rb no

Duck-typed singletons (was Re: open-uri patch, added progress_proc hook)
1719 [ruby-core@wh] Let me first outline a specific advantage to the duck-typed singleton

Syck crash (was Re: gc_sweep in Ruby 1.8)
1720 [ruby-core@wh] Agh!  Sorry, I just noticed this message!
1785 [ruby-core@wh] This segfaulting of Syck has been discovered and eliminated.

Re: "stereotyping"
1721 [transami@ru ] Sorry I forgot to post results of DuckHunter examples. (DuckHunter itself is

Cascading class definitions effect objects
1728 [transami@ru ] I'm doing some hard nosed analysis of AOP for Ruby (:pre, :wrap, etc.) as this
+ 1729 [george.marro] I haven't seen any Ruby program that uses this, but...
| 1730 [transami@ru ] Nice, I can see how it would be useful in this regard. A very valid and
| 1734 [matju@sy pa ] do you mean freezing a singleton class?
+ 1735 [ser@ge ma e-] Yes.  I've used it a few times, although in most cases Ruby's singletons are a
+ 1736 [matju@sy pa ] If you want a suitable analogy for your real world: when you realize that

block locals & Ruby2  [was Re: open-uri patch, added progress_proc hook]
1743 [batsman.geo@] def foo(n)
1744 [transami@ru ] actually using
1764 [batsman.geo@] This is the behavior matju wanted (n independent counters). It works in

Controlled block variables (was: open-uri patch, added progress_proc hook)
1751 [transami@ru ] In considering some of the things we've been discussing related to the
+ 1755 [jgb3@em il b] a = [ 1, 2, 3 ]
| 1756 [transami@ru ] a=[1,2,3]
| + 1760 [ser@ge ma e-] But... this doesn't work in Ruby anyway.  'a' isn't in scope inside the
| | + 1761 [transami@ru ] What's the point of having eval, then? Look at your example. By your argument
| | | + 1765 [ser@ge ma e-] eval "a = [1,2,3] ; def z ; p a ; end ; z"
| | | | 1767 [transami@ru ] "You take the blue pill, the story ends...you wake up in
| | | | 1769 [ser@ge ma e-] Yup.  I'm a stick in the mud... I like my code to follow the same rules
| | | | 1770 [transami@ru ] Well okay. But I use eval a lot and I can honestly say that having a way to do
| | | | 1774 [matju@sy pa ] I am a bit perplexed by that comment too. I thought he was one of the
| | | | 1784 [ser@ge ma e-] Hah!  So true.  What's your super-power, Mathieu?
| | | + 1771 [sdmitry@lr .] I think that eval just gives access to ruby interpreter itself in run-time.
| | | | 1772 [transami@ru ] Hey! That's a workable solution. Not quite as clean, but it works for me.
| | | + 1779 [dblack@wo bl] No, by Sean's argument there is no point having eval do some kind of
| | |   + 1780 [dblack@wo bl] Whoops, make that
| | |   + 1781 [transami@ru ] You're a real whirlwind of positive attitude.
| | |   + 1790 [matju@sy pa ] A classic of evaluating strings is evaluating SQL code, and almost
| | |     1791 [chad@ch df w] #
| | |     + 1796 [transami@ru ] You're just talking a different language, but you're still evaluating. In
| | |     | 1797 [pit@ca it in] Haven't you seen my proposal in [ruby-talk:86349] using define_method?
| | |     + 1801 [austin@ha os] I've been thinking about this, and I *would* like to see a way to do
| | |       1806 [transami@ru ] (Obvious but) You have my vote Austin, if it's worth anything.
| | + 1775 [transami@ru ] "Wait a minute."  Why isn't  a  available in the scope of this method
| |   + 1777 [stillflame@F] in fact,
| |   + 1782 [ser@ge ma e-] I know what you mean.  I tend to want to scope things up when using irb; that
| |     1787 [transami@ru ] Honestly, I have always felt funny about
| + 1786 [rpav@me hl .] I had a sudden inspiration with respect to this problem.  As others
+ 1768 [transami@ru ] On second thought, I think the use of #{ ... } may be a poor choice. Perhaps

gc_sweep under 1.8 ... not syck.so
1753 [rich@in oe h] We still encountered a gc_sweep in our use of Ruby 1.8 on Linux (v8).
1754 [decoux@mo lo] Do you use threads ?
1757 [rich@in oe h] Yes, there are several (Ruby) threads working during this gc_sweep.
1758 [decoux@mo lo] Best to update to 1.8.1 or retrieve the patch for 1.8.0. There is a well
1763 [rich@in oe h] of course this effects 300 machines ;-)
1778 [decoux@mo lo] The patch is in RC2, this is this problem
1802 [rich@in oe h] [asmt@sv022 coredump]$ ruby -v
1803 [decoux@mo lo] It will be faster if you can write a small program, to make possible to
+ 1804 [rich@in oe h] Trust me, I would if I could.  This is intermittent.  We have a 12,000
+ 1805 [rich@in oe h] There is a discussion (found by chad fowler) on ruby-dev (22000)
  + 1809 [decoux@mo lo] but why in [ruby-core:1802] there is
  + 1810 [decoux@mo lo] OK, this is [ruby-dev:22005] apparently your configure use pthread. try it

FileUtils.cp should use to_str?
1795 [gsinclair@so] require 'pathname'
1835 [aamine@lo er] That sounds nice.

Syck install on Debian Standard (Ruby 1.6.7)
1799 [transami@ru ] actually the person doing the install, the admin of the site is. So I can't
1800 [transami@ru ] Oh, it looks like it's missing mkmf.rb is not included in 1.6.7? can I install
1807 [batsman.geo@] apt-get install ruby-dev
1808 [transami@ru ] Doh!
1814 [transami@ru ] Knew this would happen. The Ruby part of Syck installed. But the PHP bindings

string.c bug and (broken) patch
1812 [chad@ch df w] ...
+ 1813 [decoux@mo lo] Yes, just use the debugger and when it crash make
+ 1817 [nobu.nokada@] String.allocate[0,2] = ""
  1818 [chad@ch df w] # Hi,

Syck with Ruby 1.6.7 Lost Character
1815 [transami@ru ] There seems to be a bug using the latest Syck with Ruby 1.6.7. When I to_yaml
1816 [transami@ru ] Well that was an easy fix. Seemed so strange that I thought it had to be a

Re: configure.in: do not override CCDLDFLAGS, LDFLAGS, XLDFLAGS
1819 [sunshine@su ] Unfortunately, this change breaks the Apple/NeXT builds when the
1820 [eban@os ri .] Ok.  I chose option #1, too.  Commited.  Thanks.
1821 [sunshine@su ] Thank you.
1822 [eban@os ri .] Doh! Thanks.

* configure.in: keep ARCH_FLAG separate. export ARCH_FLAG.
1823 [sunshine@su ] I am afraid that I do not understand why you made this change.
1824 [eban@os ri .] I forgot add ARCH_FLAG to DLDFLAGS in lib/mkmf.rb.
1825 [sunshine@su ] That works correctly.  Thank you.  :-)

NeXT configure.in patch
1826 [sunshine@su ] When Matze committed my patch to revive the NeXT ports recently, he
1828 [eban@os ri .] Applied.  Thanks.

configure mkdir -p patch
1827 [sunshine@su ] When I submitted the patch to revive the NeXT ports of Ruby a couple
1875 [matz@ru y- a] autoconf is not for users, but developers, so that I thought it's OK
1876 [sunshine@su ] Okay.  Thank you for the explanation.  :-)

BUG: clean/distclean bug
1829 [sunshine@su ] make clean

Constants, class variables and the cbase field
1830 [george.marro] Can anyone explain to me the workings of the cbase field in eval.c's struct
1831 [decoux@mo lo] cbase don't exist in the CVS version.
1838 [george.marro] Guy - thanks for the response - I certainly wasn't aware that it had been
1839 [decoux@mo lo] Well, imagine that someone write
1842 [george.marro] Hmm, well .. I didn't know you could do that :)  But anyway .. the subtext
1844 [matz@ru y- a] What kind of behavior do you want (to change)?  Remember you're saying
1846 [george.marro] Matz - I didn't mean to denigrate your decision, but like you say, it's not

Fwd: Access to CVS lost again
1832 [ser@ge ma e-] Sending this again and CC'ing the core list, because I didn't get any response

CVS troubles
1833 [ser@ge ma e-] By the way, I can recommend both Subversion (subversion.tigris.org) and Darcs

New syck bug
1834 [chad@ch df w] There is a new syck bug that appears to be caused by the recent fix for
+ 1837 [chad@ch df w] # There is a new syck bug that appears to be caused by the recent fix for
+ 1840 [ruby-core@wh] Yeah, I'm not sure this is the YAML you want to be generating.  I
  + 1841 [chad@ch df w] # >
  + 1852 [dblack@wo bl] Here's a YAML-to-YAML version, same result (just for baseline
    1854 [rich@in oe h] ok...so this line number thing is freaking me out.  Are you saying that
    1855 [rich@in oe h] s/Revaletions/Revelations
threads.html
top