Hi Matt,

On Fri, 2009-11-20 at 19:27 -0500, Matt Arsenault wrote:
> Hi,
> The newAttrFromUIntProperty type functions were using Int instead of
> Word.There were a couple other similar minor errors, such as using
> GType.uint for the Char properties, and UChar properties were missing.
> 

Thanks for your patch. However, I think in Haskell, it is very common to
use Int even if a value is guaranteed to be unsigned. For instance,
length :: [a] -> Int returns an Int even though the length of a list can
never be negative. We follow this convention in Gtk2Hs since otherwise
(and in contrast to C) you need to sprinkle fromIntegral everywhere in
your program which rather obfuscates the code.

While it could be that we get wrong values for very large numbers (which
will become negative when represented by Int), this is already the case
for Int since according to the Haskell standard, Int does not have to
have more than (I think) 29 bits or so. Thus, even converting a CInt to
a Haskell Int is prone to incorrect representation.

As to UChar, I don't think there are any properties that we bind that
are of this type. Since the modules in Glib are only really used to
create the bindings in Gtk.* and other modules, we only bind things we
really need.

Thus, what you've repaired is a deliberate design choice that is meant
to make the life of an application developer easier. Hence, I think its
better not to apply your patch.

Cheers,
Axel.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gtk2hs-devel mailing list
Gtk2hs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel

Reply via email to