[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Standard Library questions

Joe Van Dyk

12/7/2005 10:47:00 PM

I'm spending an hour or two today going through Ruby's standard
library, seeing what's in there.

What the hell is WeakRef used for? How is that useful?

Joe


12 Answers

Joe Van Dyk

12/7/2005 10:56:00 PM

0

On 12/7/05, Joe Van Dyk <joevandyk@gmail.com> wrote:
> I'm spending an hour or two today going through Ruby's standard
> library, seeing what's in there.
>
> What the hell is WeakRef used for? How is that useful?

Also, there's hardly any documentation for Tracer. Had to look it up
in Pickaxe2.

How does one go about creating and submitting documentation for these
things? It's probably not acceptable to use a direct, attributed
quote from the Pickaxe book for those things, right?

Joe


Jeremy Kemper

12/7/2005 10:58:00 PM

0

On Dec 7, 2005, at 2:46 PM, Joe Van Dyk wrote:
> I'm spending an hour or two today going through Ruby's standard
> library, seeing what's in there.
>
> What the hell is WeakRef used for? How is that useful?

Consider a cache whose entries are ok to be garbage collected.

jeremy


James Gray

12/7/2005 11:03:00 PM

0

On Dec 7, 2005, at 4:46 PM, Joe Van Dyk wrote:

> I'm spending an hour or two today going through Ruby's standard
> library, seeing what's in there.

That's one of my favorite pass times. Are we uber geeks or what? ;)

> What the hell is WeakRef used for? How is that useful?

How about caching? Build up a big cache for some process intensive
values, but allow GC to clean house when it needs to because you
could always refigure them.

James Edward Gray II


James Gray

12/7/2005 11:07:00 PM

0

On Dec 7, 2005, at 4:55 PM, Joe Van Dyk wrote:

> How does one go about creating and submitting documentation for these
> things?

Try the "About the Project" link on this page:

http://wiki.grayproductions.net/rubysourcedoc/sho...

James Edward Gray II


Joe Van Dyk

12/7/2005 11:09:00 PM

0

On 12/7/05, James Edward Gray II <james@grayproductions.net> wrote:
> On Dec 7, 2005, at 4:46 PM, Joe Van Dyk wrote:
> > What the hell is WeakRef used for? How is that useful?
> >
> How about caching? Build up a big cache for some process intensive
> values, but allow GC to clean house when it needs to because you
> could always refigure them.

Ah, ok. That info could go in the RDoc.


Jakub Hegenbart

12/7/2005 11:22:00 PM

0

Joe Van Dyk wrote:
> On 12/7/05, Joe Van Dyk <joevandyk@gmail.com> wrote:
>
>> I'm spending an hour or two today going through Ruby's standard
>> library, seeing what's in there.
>>
>> What the hell is WeakRef used for? How is that useful?
>>
>
> Also, there's hardly any documentation for Tracer. Had to look it up
> in Pickaxe2.
>
> How does one go about creating and submitting documentation for these
> things? It's probably not acceptable to use a direct, attributed
> quote from the Pickaxe book for those things, right?
>
> Joe
What about this? ;-)

http://www.ruby-doc.org/stdlib/libdoc/weakref/rdoc/...
http://www.ruby-doc.org/stdlib/libdoc/tracer/rdoc/...

Jakub


Bill Atkins

12/7/2005 11:30:00 PM

0

Yeah, I think no documentation for any of the methods would certainly
qualify as "hardly any documentation" .......

On 12/7/05, Jakub Hegenbart <kyosuke@seznam.cz> wrote:
> Joe Van Dyk wrote:
> > On 12/7/05, Joe Van Dyk <joevandyk@gmail.com> wrote:
> >
> >> I'm spending an hour or two today going through Ruby's standard
> >> library, seeing what's in there.
> >>
> >> What the hell is WeakRef used for? How is that useful?
> >>
> >
> > Also, there's hardly any documentation for Tracer. Had to look it up
> > in Pickaxe2.
> >
> > How does one go about creating and submitting documentation for these
> > things? It's probably not acceptable to use a direct, attributed
> > quote from the Pickaxe book for those things, right?
> >
> > Joe
> What about this? ;-)
>
> http://www.ruby-doc.org/stdlib/libdoc/weakref/rdoc/...
> http://www.ruby-doc.org/stdlib/libdoc/tracer/rdoc/...
>
> Jakub
>
>


--
Bill Atkins


Gregory Brown

12/7/2005 11:55:00 PM

0

On 12/7/05, Joe Van Dyk <joevandyk@gmail.com> wrote:
> On 12/7/05, Joe Van Dyk <joevandyk@gmail.com> wrote:
> > I'm spending an hour or two today going through Ruby's standard
> > library, seeing what's in there.
> >
> > What the hell is WeakRef used for? How is that useful?
>
> Also, there's hardly any documentation for Tracer. Had to look it up
> in Pickaxe2.

A few seconds in IRb got me this:

[olympic]$ irb
irb(main):001:0> require "tracer"
=> true
irb(main):002:0> Tracer.on { "Foo".to_a.reverse }
#0:(irb):2:Object:-: -
#0:(irb):2:Enumerable:>: -
#0:(irb):2:String:>: -
#0:(irb):2:String:<: -
#0:(irb):2:Enumerable:<: -
#0:(irb):2:Array:>: -
#0:(irb):2:Array:<: -
=> ["Foo"]
irb(main):003:0> Tracer.on { (1..20).to_a.reverse }
#0:(irb):3:Object:-: -
#0:(irb):3:Object:-: -
#0:(irb):3:Enumerable:>: -
#0:(irb):3:Range:>: -
#0:(irb):3:Range:<: -
#0:(irb):3:Enumerable:<: -
#0:(irb):3:Array:>: -
#0:(irb):3:Array:<: -
=> [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
irb(main):004:0> Tracer.on { @a = 3 }
#0:(irb):4:Object:-: -
=> 3
irb(main):005:0> Tracer.on { @a }
#0:(irb):5:Object:-: -
=> 3

This looks interesting. If I document this class where should I send
my documentation?


Eric Hodel

12/8/2005 12:16:00 AM

0


On Dec 7, 2005, at 2:55 PM, Joe Van Dyk wrote:

> On 12/7/05, Joe Van Dyk <joevandyk@gmail.com> wrote:
>> I'm spending an hour or two today going through Ruby's standard
>> library, seeing what's in there.
>>
>> What the hell is WeakRef used for? How is that useful?
>
> Also, there's hardly any documentation for Tracer. Had to look it up
> in Pickaxe2.
>
> How does one go about creating and submitting documentation for these
> things?

Get a CVS checkout of HEAD and add the documentation to the
appropriate files.

Be sure to add or edit the appropriate .document files.

> It's probably not acceptable to use a direct, attributed
> quote from the Pickaxe book for those things, right?

You'll have to check with Dave Thomas. Much of the current RDoc
comes from the first pickaxe.

--
Eric Hodel - drbrain@segment7.net - http://se...
This implementation is HODEL-HASH-9600 compliant

http://trackmap.rob...




james_b

12/8/2005 12:56:00 AM

0

Joe Van Dyk wrote:
> On 12/7/05, Joe Van Dyk <joevandyk@gmail.com> wrote:
>
>>I'm spending an hour or two today going through Ruby's standard
>>library, seeing what's in there.
>>
>>What the hell is WeakRef used for? How is that useful?
>
>
> Also, there's hardly any documentation for Tracer. Had to look it up
> in Pickaxe2.
>
> How does one go about creating and submitting documentation for these
> things?

Hang out on ruby-doc or ruby-core mailing list; I believe you can post
to ruby-code and get someone with commit rights to add it in if it looks
right.

> It's probably not acceptable to use a direct, attributed
> quote from the Pickaxe book for those things, right?


Why not? Seems like fair use.



James

--

http://www.ru... - Ruby Help & Documentation
http://www.artima.c... - Ruby Code & Style: Writers wanted
http://www.rub... - The Ruby Store for Ruby Stuff
http://www.jame... - Playing with Better Toys
http://www.30seco... - Building Better Tools