comments from an experienced programmer on ruby docs
[email protected] Wed, 28 Jul 2010 11:41:38 -0700
| Newsgroups | gmane.comp.lang.ruby.documentation |
|---|---|
| Message-ID | <[email protected]> |
--MW5yreqqjyrRcusr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hey there, I am learning ruby for my hard drive backup project: http://www.subspacefield.org/security/hdb/ Ruby is a cool language, but the documentation is a little hard to read. Many people use the term "Foo#whatever" with the assumption that one knows what it means - I originally assumed it was an instance method, but now believe it is a class method. Since it's a special character, you can't really search google for it easily. Regarding http://rubylearning.com/: the formatting of the text boxes is awful, since at least on my computer, it requires manually scrolling every one, effectively peering at the program through a tiny viewport. The content, however, is very good. One thing that needs discussion is how everything except ints and floats (and perhaps some other types) are passed by reference. I got really bit by passing strings into constructors, and the constructor later modified the string, and that changed the value of the thing I passed in. This is true for arrays as well, and any user-defined objects. Since this is a change from how many other scripting languages work, you should point it out a little better (it is hinted at). In essence, you'll want to dup any parameter before modifying it (unless again it is an integer or float). I assume these are the objects that correspond to "what fits in a register" in C. I make it a practice to dup everything that gets passed into a constructor. In any case, this is a lot closer to C than I expected. Regarding: http://www.ruby-lang.org/en/documentation/ruby-from-other-languages/to-ruby= -from-python/ * The notions of equality (=3D=3D vs eql?) differ from that of python. * The keyword parameter stuff can be moved from the higher level page to th= is one, since it's targeted at python programmers. Generally: You should show how to delegate a method generically. In other words, "I don't know how the delegatee will implement this, how the caller will invoke it, or whatever - I just want to pass calls to method blah through" --=20 A Weapon of Mass Construction My emails do not have attachments; it's a digital signature that your mail program doesn't understand. | http://www.subspacefield.org/~travis/=20 If you are a spammer, please email [email protected] to get blackliste= d. --MW5yreqqjyrRcusr Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (OpenBSD) iQIcBAEBAgAGBQJMUHnhAAoJEGQVZZEDJt9HHj0P/RabnrAc7np/c9NGTlFTGanp 7wIp6KiVcvoB4lPYcDZQ0MMqYAT1sw/aM9Q4nc4Pu5OtZD5dvH8R6FClF/jW/Nfi bZWerYG1efMfFeYb4Kw+I70zRGFwmGAUI0exLBDN59PEeljSjhjZLG32kcha3tPI kuz30gjyOF8wLT6U7KjexXaVTsgGcpwEPVrafqgVmDvzeDAWxFElNF61i/NnO40t g3wUeGjPaJq8MUkBdiN1qyNmg1CvXZJdLMd9cThI5X6at8Lr7H0pR3+nt44ZORrI mgSQ9hWjdK8QneIW/jepYY0w8t3cpam2d/VN4lvVTg0QANODpOEwACEn40kbi+jF PfXsUDExLqczjfNDG1FWvuDHr1NHzNFSbCiAI2LxlenraNtbOqtjU3wfzeqxyZTC V6hysl3FUDMC3xk1LN4wTeX0F4oCt/qeSeXrHAbCPOPKfqVebnMbUqNpTlZ/xZ1U 3Ch4pJzKn5IdOER+pWKktATlGKpxUBYEVHInyQPyp6/onhL01sJ+BNezdgJvE96E qArb4Qqdpo2yCimpeYUUh4j4dPJQFMlXg1Z5SKHipZAuMUlmc7AAVb25Ve93yAcx pGEdME9dIGv6iUdDt76Xk2z/fCjyDi0ajtJmyBwWDrGk2CUPLOH33ur7RBUMir3f tHgoPmYz1bjDwTIb0khd =ZSuy -----END PGP SIGNATURE----- --MW5yreqqjyrRcusr--