[Gtk-sharp-list] Generating returns instead of out params

yoros@wanadoo.es yoros@wanadoo.es
Tue, 25 Feb 2003 22:11:16 +0100


On Tue, Feb 25, 2003 at 07:23:05PM +0000, fd wrote:
> Right now, the code generator cunningly turns 
> 
>         static extern void gtk_text_buffer_get_start_iter(IntPtr raw,
>         out Gtk.TextIter iter);
> 
> into
> 
>         public Gtk.TextIter StartIter {}
> 
> However,
> 
>         static extern void gtk_text_buffer_get_iter_at_offset(IntPtr
>         raw, out Gtk.TextIter iter, int char_offset);
> 
> is still generated as
> 
>         public void GetIterAtOffset(out Gtk.TextIter iter, int
>         char_offset) {}
> 
> Should we look into generating this instead?
> 
>         public Gtk.TextIter GetIterAtOffset(int char_offset) {}
> 
> Where in Parameters.cs would this particular manipulation be made? A lot
> of the logic to detect this situation already seems to exist in there,
> so I don't want to reinvent the wheel.

As here says...

I think that all Iters (I know TextIter and TreeIter on the models) must
be returned by the methods that create them and not in an out parameter.

Another thing that I see in the iterators is that are implemented as
structs and it is much more efficient to use objects because using out
parameters are slow than using references (objects).

For finish with the iterators I waht to remark that they must implement
IEnumerator interface and must have all the code for moving around the
widget they depend...

TextIter -> public class TextEnumerator : IEnumerator { }

I think this is the best way to get a great design in GTK# and I think
(and want) that we can redesign GTK# now and not when a lot of people
were using it.

Regards,

    Pedro

-- 
Pedro Martinez Juliá
\  yoros@terra.es
)|    yoros@wanadoo.es
/        http://yoros.cjb.net
Socio HispaLinux #311
Usuario Linux #275438 - http://counter.li.org
GnuPG public information:  pub  1024D/74F1D3AC
Key fingerprint = 8431 7B47 D2B4 5A46 5F8E  534F 588B E285 74F1 D3AC