Standard Library questions

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

On 12/7/05, Joe Van D. [email protected] 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

On Dec 7, 2005, at 2:46 PM, Joe Van D. 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

On Dec 7, 2005, at 4:46 PM, Joe Van D. 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? :wink:

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 G. II

On Dec 7, 2005, at 4:55 PM, Joe Van D. 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/show/HomePage

James Edward G. II

On 12/7/05, James Edward G. II [email protected] wrote:

On Dec 7, 2005, at 4:46 PM, Joe Van D. 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.

Joe Van D. wrote:

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? :wink:

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

Jakub

Yeah, I think no documentation for any of the methods would certainly
qualify as “hardly any documentation” …

On 12/7/05, Joe Van D. [email protected] wrote:

On 12/7/05, Joe Van D. [email protected] 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?

Joe Van D. wrote:

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.ruby-doc.org - Ruby Help & Documentation
Ruby Code & Style - Ruby Code & Style: Writers wanted
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys
http://www.30secondrule.com - Building Better Tools

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

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 T… Much of the current RDoc
comes from the first pickaxe.


Eric H. - [email protected] - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

On 12/7/05, James Edward G. II [email protected] wrote:

On Dec 7, 2005, at 5:55 PM, Gregory B. wrote:

If I document this class where should I send my documentation?

I already answered this question once in this thread. :wink: Here’s

I saw this, read this, some how skipped to the wrong page, and said,
this doesn’t have enough information. Now that I’m looking at the
right stuff, I am better situated. :slight_smile:

On Dec 7, 2005, at 5:55 PM, Gregory B. wrote:

If I document this class where should I send my documentation?

I already answered this question once in this thread. :wink: Here’s
what I said:

Try the “About the Project” link on this page:

http://wiki.grayproductions.net/rubysourcedoc/show/HomePage

James Edward G. II