Standard Library questions

J

Joe Van Dyk

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
 
J

Joe Van Dyk

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
 
J

Jeremy Kemper

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
 
J

James Edward Gray II

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
 
J

Joe Van Dyk

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.
 
B

Bill Atkins

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

Gregory Brown

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"
=3D> 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:<: -
=3D> ["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:<: -
=3D> [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 =3D 3 }
#0:(irb):4:Object:-: -
=3D> 3
irb(main):005:0> Tracer.on { @a }
#0:(irb):5:Object:-: -
=3D> 3

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

Eric Hodel

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.
 
J

James Britt

Joe said:
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.ruby-doc.org - Ruby Help & Documentation
http://www.artima.com/rubycs/ - 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
 
G

Gregory Brown

I already answered this question once in this thread. ;) 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. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top