--------------enig3C92BCECC5B174C5752E94E5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Patrick Hurley wrote: > On 11/12/06, Alfonso <euoar / yahoo.es> wrote: >> Sorry for the too elemental question (don't know if this is the right >> place to make questions like this) I just have started with ruby, and >> don't understand the difference "::" "." I have read that :: is for >> accessing constants, but then I see, that, for example, I can make a new >> object like with ::new or .new. Could anyone explain that? > > There is some overlap, but in general usage, use :: to access names > that are scoped within modules and use . to send messages (call) > methods. > To be precise, :: and . are completely equivalent operators to call methods of an object. I think (not really sure) that an older version of Ruby only let you use :: for class methods, but that's no longer the case. Only :: can be used for constant lookup; it's idiomatic to use . for any method calls, as Patrick says. David Vallner --------------enig3C92BCECC5B174C5752E94E5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (MingW32) iD8DBQFFV1hyy6MhrS8astoRAvg7AKCAizjZCNJkTkxJEU+owqfQ4je7pgCdE+RG S61Dnz1MP1zmZrZ4ftX/cw0 Ci -----END PGP SIGNATURE----- --------------enig3C92BCECC5B174C5752E94E5--