[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: Is this old style Ruby?
From:       Bertram Scharpf <lists () bertram-scharpf ! de>
Date:       2005-02-16 0:14:44
Message-ID: 20050216000924.GD10627 () homer ! bertram-scharpf
[Download RAW message or body]

Hi,

Am Dienstag, 15. Feb 2005, 22:54:54 +0900 schrieb centrepins@gmail.com:
> In Why's guide, I see the line:
> 
> File::open( ...etc.
> 
> Up 'til now I've always written this as:
> 
> File.open( ...etc.
> 
> (ie. using a . rather than a ::).  Am I right in thinking the :: for
> accessing class methods is now old-style?

`::' may be used to qualify top-level constants:

  X=1 ; class C ; X=2 ; def C.f ; ::X ; end ; end ; C.f
  # => 1

You can't do that with `.'.

Bertram

-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic