From: Saynatkari Date: 2005-04-03T23:12:35+09:00 Subject: Re: [EVALUATION] - E03 - jamLang Evaluation Case Applied to Ruby Le 3/4/2005, "Ilias Lazaridis" a �crit: >Ilias Lazaridis wrote: >> Ilias Lazaridis wrote: >[...] > >>> This document can serve as an flash-start (for people which simply >>> like to take a look on ruby). >>> >>> http://lazaridis.com/case/lang/ruby.html >> >> I hope you like the results so far. >> >> I need to fill in the interactive session, to close this thread: >> >> http://lazaridis.com/case/lang/index.html#run_interactive >> >> http://lazaridis.com/case/lang/ruby.html#run_interactive > >I've tried this: > >open command window >change to project directory >cmd: irb >within irb >cmd: require 'talker' > >talker is created, produces output. > >but: the "talker" instance which was created during read in (of >talker.rb) has died. > >why? Local variables evaluated during a require() are not accessible from outside the file; you may consider this such that the file is the scope within which the variable is defined, just like in a method body. >how do i read-in files, which produce instances, which 'survive'? Global variables (although this practice would be discouraged), which are identified by a $-prefix, e.g. $global = 'something'. Come to think of it, constants may also be accessible. Normally one will have either an accessor method of some sort or simply provide the means of _creating_ an instance. >and: how do I delete an instance? [tried: del, delete, kill, rm, free] One cannot explicitly delete an instance. It will be 'deleted' (marked for garbage collection) once it is without references. E No-one expects the Solaris POSIX implementation!