if using ref object,
type
Events = object
onload, onfail: proc (name: string)
type
SomeWrapper = ref object
events: Events
onload, onfail: proc (name: string)
proc registerEvents(wrapper: SomeWrapper) =
wrapper.events.onload = proc (name: string) = echo "loaded " & name;
wrapper.onload(name)
wrapper.events.onfail = proc (name: string) = echo "failed to load " &
name; wrapper.onfail(name)
var s = SomeWrapper()
registerEvents(s) # work
Run
- Using var object in a proc that is the object's property lqdev
- Re: Using var object in a proc that is the object's propert... Araq
- Re: Using var object in a proc that is the object's pro... lqdev
- Re: Using var object in a proc that is the object's... 2vg
- Re: Using var object in a proc that is the obje... lqdev
- Re: Using var object in a proc that is the... 2vg
