From: David Alan Black Date: 2002-04-03T08:11:12+09:00 Subject: Re: seeking to understand... Hello -- On Wed, 3 Apr 2002, Phil Tomson wrote: > class MyDesign < RHDL::Design > > def initialize() > a = Signal.new(1) #signals have a current value and history > b = Signal.new(1) > > define_behavior { > c.assign {a or b} > } > end > end > > The line: c.assign {a + b} > makes use of a closure (the '{a + b}' is a Proc object which is what Ruby > calls closures). [As a side note: Signal defines an 'assign' method that > takes either an immediate value or a proc.] I don't want to assign the > immediate value of (a or b) to c, I want to assign the function {a or b} > so that it can be calculated later with varying values for Signals a and > b. Using a Proc (which, remember, is a closure) allows me to do that. > The function {a or b} (NOTE: '{..}' are used to construct Procs) can then > be evaluated later each time the values of a and b have been changed. OK... but, in this example, how would you call the proc with different values for a and b? David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav