was on rubygarden and had this idea regarding local and blocks :
in general, i like the way things work, but occansionally would like to be
able to ‘export’ a variable from inside a block. so, i think to myself, why
not an export keyword? something
(IO.readlines (path)).each do |line|
export max = 0
…
fields = line.split delim
max = [max, fields].max
…
end
puts max >> 42
what’dya think?
export would be a cross between C’s static modifier (declared/defined once
only), but would be ‘exported’ into the parent scope - lexical or dynamic i’m
not sure - but you get the picture…
the mnemonic is like that of the shell’s ‘export var=42’
-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
====================================