Eric Hodel | 1 Aug 2006 01:02
Favicon
Gravatar

Re: mysterious conf in irb

On Jul 31, 2006, at 12:57 PM, Dave Rose wrote:

> when you run irb and type:
>>> require 'config'
>>> conf
>
> a huge amount of information prints out on the screen (at least on the
> windows 1.8.2 one-click installer irb)
> what kind of container is it where does it come from etc..

Its irb's configuration.

> i did a conf.class and got an IRB::context what kind of class is that?

Its a configuration for irb.

> i did a
> f=File.new('config.txt','w')
> f.write(config) to get a text file of its contents but don't know  
> about
> it's contents

What are you trying to accomplish?

--

-- 
Eric Hodel - drbrain <at> segment7.net - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

(Continue reading)

Clifford Heath | 1 Aug 2006 01:05

Re: Environment variables with empty value missing from ENV?

nobu <at> ruby-lang.org wrote:
> And, usa has fixed the empty value issue today.

Thankyou!

Chad Perrin | 1 Aug 2006 01:07
Gravatar

Re: I thought this was the one that worked?

On Tue, Aug 01, 2006 at 07:54:33AM +0900, Jacob Fugal wrote:
> On 7/31/06, Chad Perrin <perrin <at> apotheon.com> wrote:
> >On Tue, Aug 01, 2006 at 07:05:31AM +0900, Logan Capaldo wrote:
> >> I'm not sure I understand your question. All blocks (by blocks I mean
> >> do / end and { } ) are (lexically scoped) closures.
> >
> >I'll use a Perl example:
> >
> >sub foo {
> >  my $bar = 1;
> >  return sub { print ++$bar };
> >}
> >
> >my $baz = foo();
> >
> >Voila.  $baz contains a lexical closure.  This is the case because the
> >return value from foo() was lexically "closed" by virtue of $bar going
> >out of scope, but its value still being accessible via the coderef
> >returned from foo() and assigned to $baz.
> 
> How is this different from:
> 
>  def foo
>    bar = 1
>    return proc{ bar += 1; puts bar }
>  end
> 
>  begin
>    puts bar
>  rescue Exception => e
(Continue reading)

Eric Hodel | 1 Aug 2006 01:19
Favicon
Gravatar

Ruby2CExtension (Was: converting some autogenerated ruby code to C)

On Jul 31, 2006, at 12:54 PM, Dominik Bathon wrote:

> You could try Ruby2CExtension (http://ruby2cext.rubyforge.org/), it  
> is similar to rubyToRubyC but supports blocks and closures and  
> tries to match Ruby's semantics as close as possible. It can handle  
> most Ruby code.

I tried it, it doesn't work.

$ svn info . | egrep 'Revision|URL'
URL: svn://rubyforge.org/var/svn/ruby2cext/trunk
Revision: 10
$ svn info ../../rubynode/trunk/ | egrep 'Revision|URL'
URL: svn://rubyforge.org/var/svn/rubynode/trunk
Revision: 4
$ ruby stuff/builtin_methods_test.rb
433
cc -dynamic -bundle -undefined suppress -flat_namespace  -fno-common - 
O -pipe -fno-common -g -I. -I /usr/local/lib/ruby/1.8/powerpc- 
darwin8.7.0 -o bm_test.bundle bm_test.c -lruby185-static -ldl -lobjc
$ ruby -rbm_test -e0
./bm_test.bundle: [BUG] Bus Error
ruby 1.8.5 (2006-07-25) [powerpc-darwin8.7.0]

Abort trap
$ gdb `which ruby`
GNU gdb 6.3.50-20050815 (Apple version gdb-477) (Sun Apr 30 20:06:22  
GMT 2006)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and  
(Continue reading)

F. Senault | 1 Aug 2006 01:30
Favicon

Re: Question regarding postings in comp.lang.ruby

Le 31 juillet 2006 à 22:56, James Edward Gray II a écrit :

> I screwed up those links.  I meant:
> 
>    http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/202655
> 
>    http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/202680

------=_Part_81117_24403003.1153300936075
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

And 

------=_Part_82136_1234888.1153309282756
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

HTML posts, probably.

Bingo :

Jul 19 11:22:46 talisker nnrpd[24018]: bristol.highgroove.com post failed 437 HTML post
Jul 19 13:41:53 talisker nnrpd[39409]: bristol.highgroove.com post failed 437 HTML post

(Based on the posting date - I'm in GMT+2 right now.)

Now, I could disable the filter, but the posts might not go far on
(Continue reading)

Eric Mahurin | 1 Aug 2006 01:40
Picon

Re: converting some autogenerated ruby code to C

On 7/31/06, Dominik Bathon <dbatml <at> gmx.de> wrote:
> > What you have sounds quite robust and able to handle a wide variety of
> > ruby functionality.  Unfortunately, it still doesn't help much on the
> > performance front :(   1-1.5X just doesn't seem like enough to justify
> > the effort.  The main problem looks to be rb_funcall*.
>
> Yes, rb_funcall seems to be slow. That's exactly what the public builtin
> methods optimization tries to address, it replaces the rb_funcall with
> (almost) only two C calls. Have you tried the svn version?

Cool.  I have not tried any of your stuff yet.  I'm not at my ruby
development machine right now.

> > Out of curiousity, could this be used with meta-classes?  I do
> > something like this to get self-defining methods:
> >
> >         def test(a)
> >             (class << self;self;end).class_eval( "
> >                 def test(a)
> >                     #{tester("a")}
> >                 end
> >             " )
> >             test
> >         end
> >         def tester(a)
> >             %Q{puts("hello " + #{a})}
> >         end
> >
> > If I were to go down the C optimization route, I would want the
> > ability to convert the generated ruby (from #tester) to C and
(Continue reading)

James Edward Gray II | 1 Aug 2006 02:18
Gravatar

Re: Question regarding postings in comp.lang.ruby

On Jul 31, 2006, at 6:30 PM, F. Senault wrote:

> Le 31 juillet 2006 à 22:56, James Edward Gray II a écrit :
>
>> I screwed up those links.  I meant:
>>
>>    http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/202655
>>
>>    http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/202680
>
> ------=_Part_81117_24403003.1153300936075
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> Content-Transfer-Encoding: quoted-printable
> Content-Disposition: inline
>
> And
>
> ------=_Part_82136_1234888.1153309282756
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> Content-Transfer-Encoding: quoted-printable
> Content-Disposition: inline
>
> HTML posts, probably.
>
> Bingo :
>
> Jul 19 11:22:46 talisker nnrpd[24018]: bristol.highgroove.com post  
> failed 437 HTML post
> Jul 19 13:41:53 talisker nnrpd[39409]: bristol.highgroove.com post  
> failed 437 HTML post
(Continue reading)

Dominik Bathon | 1 Aug 2006 02:19
Picon
Picon

Re: Ruby2CExtension (Was: converting some autogenerated ruby code to C)

On Tue, 01 Aug 2006 01:19:57 +0200, Eric Hodel <drbrain <at> segment7.net>  
wrote:

> On Jul 31, 2006, at 12:54 PM, Dominik Bathon wrote:
>
>> You could try Ruby2CExtension (http://ruby2cext.rubyforge.org/), it is  
>> similar to rubyToRubyC but supports blocks and closures and tries to  
>> match Ruby's semantics as close as possible. It can handle most Ruby  
>> code.
>
> I tried it, it doesn't work.

Thanks for the report.

> $ svn info . | egrep 'Revision|URL'
> URL: svn://rubyforge.org/var/svn/ruby2cext/trunk
> Revision: 10
> $ svn info ../../rubynode/trunk/ | egrep 'Revision|URL'
> URL: svn://rubyforge.org/var/svn/rubynode/trunk
> Revision: 4
> $ ruby stuff/builtin_methods_test.rb
> 433
> cc -dynamic -bundle -undefined suppress -flat_namespace  -fno-common -O  
> -pipe -fno-common -g -I. -I /usr/local/lib/ruby/1.8/powerpc-darwin8.7.0  
> -o bm_test.bundle bm_test.c -lruby185-static -ldl -lobjc
> $ ruby -rbm_test -e0
> ./bm_test.bundle: [BUG] Bus Error
> ruby 1.8.5 (2006-07-25) [powerpc-darwin8.7.0]

This might be the problem, it is explicitly only for 1.8.4 (the official  
(Continue reading)

Logan Capaldo | 1 Aug 2006 02:50
Picon

Re: I thought this was the one that worked?


On Jul 31, 2006, at 6:48 PM, Chad Perrin wrote:

> On Tue, Aug 01, 2006 at 07:05:31AM +0900, Logan Capaldo wrote:
>>
>> On Jul 31, 2006, at 5:13 PM, Chad Perrin wrote:
>>
>>> On Tue, Aug 01, 2006 at 04:57:48AM +0900, Logan Capaldo wrote:
>>>>
>>>> All these examples are lexical scoping. Ruby doesn't really have
>>>> dynamic scoping although you can sort of abuse instance  
>>>> variables to
>>>> achieve similar effects.
>>>>
>>>> The difference is that blocks are closures, where def, class, and
>>>> module aren't.
>>>
>>> Wait . . . you mean that *all blocks* are automagically lexical
>>> closures, as though declared lexical variables within them have
>>> gone out
>>> of scope?  I imagine I'm probably misunderstanding you, but if not,
>>> that's a pretty nifty bit of trickery.
>>>
>> I'm not sure I understand your question. All blocks (by blocks I mean
>> do / end and { } ) are (lexically scoped) closures.
>
> I'll use a Perl example:
>
> sub foo {
>   my $bar = 1;
(Continue reading)

Logan Capaldo | 1 Aug 2006 02:57
Picon

Re: I thought this was the one that worked?


On Jul 31, 2006, at 7:07 PM, Chad Perrin wrote:

> On Tue, Aug 01, 2006 at 07:54:33AM +0900, Jacob Fugal wrote:
>> On 7/31/06, Chad Perrin <perrin <at> apotheon.com> wrote:
>>> On Tue, Aug 01, 2006 at 07:05:31AM +0900, Logan Capaldo wrote:
>>>> I'm not sure I understand your question. All blocks (by blocks I  
>>>> mean
>>>> do / end and { } ) are (lexically scoped) closures.
>>>
>>> I'll use a Perl example:
>>>
>>> sub foo {
>>>  my $bar = 1;
>>>  return sub { print ++$bar };
>>> }
>>>
>>> my $baz = foo();
>>>
>>> Voila.  $baz contains a lexical closure.  This is the case  
>>> because the
>>> return value from foo() was lexically "closed" by virtue of $bar  
>>> going
>>> out of scope, but its value still being accessible via the coderef
>>> returned from foo() and assigned to $baz.
>>
>> How is this different from:
>>
>>  def foo
>>    bar = 1
(Continue reading)


Gmane