[Gtk-sharp-list] "format-value" signal in Gtk.Scale
10 Mar 2003 23:46:58 -0600
On Mon, 2003-03-10 at 04:35, Lee Mallabone wrote:
> > Any event that wraps a signal with a non-void return type in the
> > "native" api should be documented to indicate how RetVal should be set.
> I think the whole API would be nicer and more obvious if return values
> were, well, returned.
Except that if you scan the entire ms class library documentation you
will not find a single event delegate that returns a value. This is, I
believe, because of the unpredictable nature of the order of invocation
of multicast delegates. I recall reading somewhere that delegates used
as events should always have a void return value.
> Is the 'RetVal' way of doing things a constraint forced by the
> underlying Gtk+ system in some way?
No, it's a .net-ism. Many gtk hackers have bitched about the use of
EventHandler subclasses for events in Gtk#, instead of specific signal
prototypes. Gtk# actually has to do work to map the args.RetVal onto a
signalhelper delegate's return value.
> The whole notion of having to set a return value when the return type of
> the delegate is actually 'void' seems likely to really confuse newcomers
> to Gtk#...
Well, if anyone can convince me with documentation that non-void
delegates as events are being used safely and effectively elsewhere in
.net, I'd consider changing this. I think the current method will be
least confusing to people familiar with .net paradigms, and I'm also not
convinced that using non-void delegates for events is correct.
Mike Kestner <firstname.lastname@example.org>