[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] Not urgent: a plausible micro-optimization
From: |
Vadim Zeitlin |
Subject: |
Re: [lmi] Not urgent: a plausible micro-optimization |
Date: |
Fri, 23 Feb 2018 17:29:12 +0100 |
On Fri, 23 Feb 2018 12:17:21 +0000 Greg Chicares <address@hidden> wrote:
GC> On 2018-02-23 02:24, Vadim Zeitlin wrote:
GC> > On Thu, 22 Feb 2018 23:26:47 +0000 Greg Chicares <address@hidden> wrote:
GC> >
GC> > GC> On 2018-02-22 13:31, Vadim Zeitlin wrote:
GC> [...]
GC> > GC> > 2. Replace the existing assignment with a copy. This is what I did
in a
GC> > GC> > new https://github.com/vadz/lmi/pull/69
GC> > GC>
GC> > GC> I'm not opposed to accommodating the wx container classes. But I'd
GC> > GC> rather not use a for-loop to bring one element to the front [and I
GC> > GC> don't think that's exactly the loop you intended to write anyway].
GC> >
GC> > To be honest, for me the most straightforward way remains to write the
GC> > code in the way I had done originally, i.e. first update the active child
GC> > and then all the rest in a loop. All the other ones seem more or less
GC> > equally artificial to me.
GC>
GC> My native language is still APL,
I do wonder why haven't you rewritten lmi in Perl 6 yet. With its wealth
of Unicode operators, hyper-operators etc it's a better APL than APL ever
was (and I'm being absolutely serious -- now whether it's enough to attract
people other than you to it, is another question).
GC> in which the original version
GC> of this code would be:
GC> Update¨ChildList
[...]
GC> Update¨ActiveChild,(ActiveChild≠ChildList)/ChildList
[...]
GC> Update¨(ChildList⍳ActiveChild)⌽ChildList
GC>
GC> or, in an extended dialect that provides ∪ (uniquify):
GC>
GC> Update¨∪ActiveChild,ChildList
GC>
GC> which is probably the prettiest possible
I think it's subjective and really depends on your current mood -- which
is determined by the language you're using. I think I'd find (any/all of)
the above quite natural in a Haskell program or, indeed, a Perl 6 one, but
in C++ this stands out as being weird as it's not really a functional
language and trying to use it as one typically doesn't work well.
GC> > GC> How about the following alternative?
GC> [...]
GC> > GC> + // Make a local copy of the list for modification.
GC> > GC> + wxWindowList const& y = frame_->GetChildren();
GC> > GC> + std::list<wxWindow*> z(y.begin(), y.end());
GC> [...]
GC> > This was actually my first attempt, and I should have mentioned it, but
it
GC> > doesn't compile because wxWindowList::const_iterator doesn't satisfy the
GC> > input iterator requirements and in C++11 this ctor is only used when this
GC> > is the case.
GC>
GC> Then let's solve that problem.
OK, done now in https://github.com/wxWidgets/wxWidgets/pull/744, will
merge this after it passes CI checks.
[updating wxWidgets used by lmi]
GC> But we can't do that today because of submodules, which brings us back
GC> to:
GC>
GC> http://lists.nongnu.org/archive/html/lmi/2018-02/msg00015.html
GC>
GC> | > GC> yet we might need to upgrade at any time, so we'd better rewrite
GC> | > GC> 'install_wx.make' pretty soon.
GC> | >
GC> | > Would you like me to do this or do you prefer to do it yourself?
GC> |
GC> | Let me handle that
GC>
GC> which I would like to amend thus:
GC>
GC> - Let me handle that
GC> + Yes, please!
I'll try to do this soon.
Regards,
VZ
- [lmi] Not urgent: a plausible micro-optimization, Greg Chicares, 2018/02/15
- Re: [lmi] Not urgent: a plausible micro-optimization, Vadim Zeitlin, 2018/02/17
- Re: [lmi] Not urgent: a plausible micro-optimization, Greg Chicares, 2018/02/21
- Re: [lmi] Not urgent: a plausible micro-optimization, Greg Chicares, 2018/02/21
- Re: [lmi] Not urgent: a plausible micro-optimization, Vadim Zeitlin, 2018/02/22
- Re: [lmi] Not urgent: a plausible micro-optimization, Greg Chicares, 2018/02/22
- Re: [lmi] Not urgent: a plausible micro-optimization, Greg Chicares, 2018/02/22
- Re: [lmi] Not urgent: a plausible micro-optimization, Vadim Zeitlin, 2018/02/22
- Re: [lmi] Not urgent: a plausible micro-optimization, Greg Chicares, 2018/02/23
- Re: [lmi] Not urgent: a plausible micro-optimization,
Vadim Zeitlin <=