[wxruby-users] More rubish API
Alex Fenton
alex at pressure.to
Wed Nov 5 12:29:33 EST 2008
Kirill Likhodedov wrote:
> Sometimes I find places in WxRuby API which seem to me not quite Ruby
> way compatible. :)
Yes, me too. It's pretty much a straight port of the C++ wxWidgets API,
with a few additions to make it more comfortable in ruby (eg
accessor-like method names, using symbols to name event handlers,
keyword constructors for Windows). And the wxWidgets API itself is not
especially consistent across classes in the way that similar methods work.
> I know (it's written somewhere on the wxruby site), that there is an
> acvity to make WxRuby more Rubish.
This activity - which was under the project 'wxSugar' has kind of been
in abeyance. Basically my time has been focussed on extending and
correcting the SWIG wrapping. This stuff is pretty hard for newcomers to
do - things like dealing with cross-language memory handling and
wrapping virtual classes. But much of the syntax enhancement work can be
done - or at least prototyped - in ruby.
We've also tried to keep the API stable since around version 1.9.2, so
this has limited scope for big changes. But I would see wxRuby 3.0 as
the place to be more radical and ruby-ify the API. I think then we also
have a better view of all the places where changes might be desirable,
to increase consistency.
> I don't feel enough confident in Ruby or WxRuby to fully participate,
> but I'd like to point to some places which could be improved.
Any contributions and discussions on these topics are very welcome.
> Where is the best place to do it? This mailing list or bug tracker or
> somewhere else? :)
Probably the wxruby-development mailing list for detailed syntax
discussions.
> For example, that's what I've noticed while examining RichTextAttr#apply:
> "Applies the attributes in style to the original object, but not those
> attributes from style that are the same as those in compareWith (if
> passed).
> See also RichTextAttr#combine for a function that does almost the same
> but returns a new object instead of modifying the original object."
>
> I'd mark combine as deprecated and use apply! instead, because that's
> what exclamation mark is for. What do you think?
I'd agree - but at the same time, I'd say it's important to make this
change across all places it's relevant at the same time. There are a few
other methods I think that have this pattern.
alex
More information about the wxruby-users
mailing list