From: ahoward Date: 2003-02-04T04:34:41+09:00 Subject: Re: ruby-dev summary 19437-19455 On Tue, 4 Feb 2003, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: ruby-dev summary 19437-19455" > on 03/02/04, ahoward writes: > > |why not a more general > | > | static > | > |which heap allocates/evaluates statement once in the local scope - ananlogous > |to C's static. > > C's static is global that extent is limited to enclosing block (or file). > I don't think it's what we want. not static int method () { return 42; } rather static int method () { static int count = 0; // <-- THIS STATIC printf ("method() has been called %d times\n", count++); return 42; } ruby static -> evaluated once, and once only, in the enclosing scope where 'enclosing scope' is subject to modification as per your 'block local' rules and where they are headed. -a -- ==================================== | Ara Howard | NOAA Forecast Systems Laboratory | Information and Technology Services | Data Systems Group | R/FST 325 Broadway | Boulder, CO 80305-3328 | Email: ahoward@fsl.noaa.gov | Phone: 303-497-7238 | Fax: 303-497-7259 ====================================