freeride-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [FR-devel] modification to slot.


From: Rich Kilmer
Subject: RE: [FR-devel] modification to slot.
Date: Wed, 8 May 2002 21:43:14 -0400

Well, on a data slot the "data" does not have to be a String.  It can be
any object.  This would make the "detail" difficult to figure out.  

The notification system was built for just that...notification.  I think
that a more sophisticated notification scheme should be built in a
Manager object rather than in the Slot itself.

If we come up with a nice, generic Manager that provides useful
capability we could roll it into the FreeBASE code.  

A Properties object is an example of one of these managers.  It
automatically persists data stored in the slots it manages.

-Rich

> -----Original Message-----
> From: address@hidden [mailto:freeride-
> address@hidden On Behalf Of Yohanes Santoso
> Sent: Wednesday, May 08, 2002 8:30 PM
> To: address@hidden
> Subject: Re: [FR-devel] modification to slot.
> 
> Thanks for the quick reply. I was being lazy in calling
> bus.manager/data.somemethod as bus.somemethod.
> 
> Another thing is: is there anyway we can put more information on
> notification? For example, if the buffer changes, I'd like to send out
> notification. This is easily accomplished by
> scratch.notify(:changed). However, I'd like to do two things:
> 
> 1. Show what the changes are, something like: scratch.notify(:changed,
>    diff) where diff is the difference between the old and the new
content.
> 
> 2. Give a chance for the subscriber to cancel the action represented
> by the notification.  For example, in scratch.notify(:going_to_change,
> diff), if some plugin, say the disk manager, thinks that the changes
> will exceed the available disk space (please just assume that this is
> a credible action), the disk manager will vetoed the changes.
> 
> This can either be implemented in scratch, or, make use of the
> existing messaging capability of the databus.
> 
> #1 can be done without databus modification by calling some certain
>  methods when the notification is received. But this seems like
>  workaround. Thus, may be notify can be modified to accept another
> argument?
> 
> #2 is a bit difficult without modification to slot, but with a minor
>  modif, it can be done:
> 
>       def notify(event, slot = self, detail = nil)
>         if @subscribers.size > 0
>           @subscribers.each_value do |subscriber|
>             if subscriber.kind_of? Proc
>               result = subscriber.call(event, slot, detail)
>             else
>               result = subscriber.databus_notify(event, slot, detail)
>             end
>             return subscriber if result == false
>           end
>         end
>         return @parent.notify(event, slot, detail) if
> @propogate_notifications and @databus.propogate_notifications and
@parent
>       end
> 
> So, am I going about the right way?
> 
> YS.
> 
> _______________________________________________
> Freeride-devel mailing list
> address@hidden
> http://mail.freesoftware.fsf.org/mailman/listinfo/freeride-devel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]