#ruby-lang - Sat 24 Mar 2007 between 00:01 and 00:24



cdcarterany parse_tree guru in here?
apeirosum, nice, from http://seattlerb.rubyforge.org/ImageScience.html:
ah, wait.. I didn't do the selfupdate
hagabakahmm
is it an error to access an instance variable that hasn't been initialized? in irb i seem to just get nil
AnalphaBestienil is right
apeirosit raises a warning and returns nil
err, not raises
it spits out a warning with -w
hagabakaoh
i was going to write a lazy accessor with @a || @a = value
AnalphaBestie@a ||= value
apeirosyou mean @a ||= value?
hagabakaok
apeirosthat works slightly different and is ok
hagabakabut that could trigger a warning?
apeirosshouldn't give a warn there
hagabakahmm
apeirosnope, no warning.
hagabakawhy is that?
cdcarterbecause it knows what you mean
apeirosspecial treatment it seems
@foo ||= "foo"
=> "foo"
@bar = @bar || "bar"
(irb):2: warning: instance variable @bar not initialized
=> "bar"
cdcarterit will treat it like an assignment
(which it is)
AnalphaBestie@foo = :bar rescue :baz
err
apeiroshu? wtf?
root 7650 1.4 0.0 31488 500 p1 S+ 4:15AM 0:00.01 i686-apple-darwin8-g++-4.0.1
hagabakacan i launch irb with -w?
apeiroswhat does that on my g5?
AnalphaBestiei should go in my bed
hagabakai think "@a or @a = 5" would be more appropriate since it doesn't assign if it's defined...unless it gives warning
but i can't figure out how to get -w in irb
cdcarter$VERBOSE = true should do it
AnalphaBestiehagabaka: thats why ||= exists, it only defines it if its undefined

Page: 2 9 16 23 30 37 44 51 58 

IrcArchive