On 2011/01/21 22:52:03, nicoe wrote:
> Mixing recursion and iteration seems to me like a bad practice (just a feeling
I
> have not something I have practical exemple that it's bad).
I think it is logical to iterate on leaf and recurse over the tree.
I think it is the "while" that gives you the bad feeling.
So I change it into a "for" which is better (bad design copy from other part of
the code).
On 2011/01/21 23:04:37, ced wrote:
> On 2011/01/21 22:52:03, nicoe wrote:
> > Mixing recursion and iteration seems to me like a bad practice (just a
feeling
> I
> > have not something I have practical exemple that it's bad).
>
> I think it is logical to iterate on leaf and recurse over the tree.
> I think it is the "while" that gives you the bad feeling.
> So I change it into a "for" which is better (bad design copy from other part
of
> the code).
Indeed the for looks better but it still feels stange to iterate and to recurse
at the same time.
And if leafs are special they should be a base case of your recursion.
I am quite sure that in this simple case mixing recursion and iteration is not
harmful but in more complicated cases it will probably make the code less
readable.
On 2011/01/21 23:25:08, nicoe wrote:
> On 2011/01/21 23:04:37, ced wrote:
> > On 2011/01/21 22:52:03, nicoe wrote:
> > > Mixing recursion and iteration seems to me like a bad practice (just a
> feeling
> > I
> > > have not something I have practical exemple that it's bad).
> >
> > I think it is logical to iterate on leaf and recurse over the tree.
> > I think it is the "while" that gives you the bad feeling.
> > So I change it into a "for" which is better (bad design copy from other part
> of
> > the code).
>
> Indeed the for looks better but it still feels stange to iterate and to
recurse
> at the same time.
> And if leafs are special they should be a base case of your recursion.
>
> I am quite sure that in this simple case mixing recursion and iteration is not
> harmful but in more complicated cases it will probably make the code less
> readable.
I don't see how using only recursion will make the code simpler.
> I don't see how using only recursion will make the code simpler.
In this case, it is not that simple but if you look at the domain inversion
patch the code doing this is simpler.
On 2011/01/21 23:42:18, nicoe wrote:
> > I don't see how using only recursion will make the code simpler.
>
> In this case, it is not that simple but if you look at the domain inversion
> patch the code doing this is simpler.
But you also have iteration in it.
On 2011/01/21 23:46:08, ced wrote:
> On 2011/01/21 23:42:18, nicoe wrote:
> > > I don't see how using only recursion will make the code simpler.
> >
> > In this case, it is not that simple but if you look at the domain inversion
> > patch the code doing this is simpler.
>
> But you also have iteration in it.
list comprehension is not a real iteration (that's what is so cool about it).
But as I said : in simple case it is not important but I would not use this kind
of stuff for more complex algorithms.
Issue 3977044: Reduce domain before applying active rule for issue1796
(Closed)
Created 15 years ago by ced
Modified 15 years ago
Reviewers: nicoe, bch
Base URL:
Comments: 0