[Kde-bindings] disconnecting a block in qtruby4

Richard Dale rdale at foton.es
Fri Jan 23 13:38:29 UTC 2009


On Thursday 22 January 2009 22:26:40 Davor Ocelic wrote:
> On Thu, 22 Jan 2009 14:50:53 +0000
>
> Richard Dale <rdale at foton.es> wrote:
> > On Thursday 22 January 2009 14:39:04 Davor Ocelic wrote:
> > > On Thu, 22 Jan 2009 11:43:51 +0000
> > >
> > > Richard Dale <rdale at foton.es> wrote:
> > > > The Qt3 version of QtRuby had some quite good online docs, and we
> > > > should try and get the KDE TechBase wiki up to a similar standard.
> > >
> > > Are you referring to
> > >   http://techbase.kde.org/Development/Languages/Ruby ?
> >
> > Yes, that is the Qt3 stuff that used to be on KDE developers corner
> > moved to TechBase. So we need to go through that translating to Qt4
> > where it has changed and add any new things like connecting blocks
> > with names (if we do that) and so on.
>
> A question re. programming style.
>
> I've noticed that qtruby examples are just a quick translation of
> the C equivalents, and they retain unnecessary parentheses etc. from
> C code.
>
> If we're updating the wiki page on TechBase, how about also bringing
> the code to a bit more elegant state, primarily by removing unneeded
> parentheses, such as:
>
> a = Qt::Application.new(ARGV)   -->   a= Qt::Application.new ARGV
>
> And similar.
I suppose that is a matter of taste. I usually only get rid of brackets when 
there are no args like 'foobar()', except when I want to make it clear that it 
is a function call as opposed to referencing a local variable. 

And I would alway have spaces round the assignment sign in your example above.

I think should expect a large proportion of the people reading the docs to not 
be ruby experts and so I don't think it matters that it looks a bit C/C++ ish. 
Someone who is familiar with Ruby will know you can leave out the brackets and 
they can read it either way fine, but a beginner might get confused about what 
leaving out the brackets means when they compare it with a C++ example.

-- Richard



More information about the Kde-bindings mailing list