Re: [dev] [RFC] Design of a vim like text editor
Greetings.
On Wed, 17 Sep 2014 06:29:01 +0200 Maxime Coste <frrrwww_AT_gmail.com> wrote:
> On Tue, Sep 16, 2014 at 11:02:40PM +0200, Christoph Lohmann wrote:
> > This is programming and not your playground. Avoid fancy code.
>
> I guess that is a matter of taste, I just know m1 + m2 calls operator+(Matrix, Matrix).
Which is, like in other answers stated, not obvious. You have to look up
the definition to read the source. Hint: Here complexity in the system
can be avoided completely.
> > Suckless is about writing simple code bases. When your choice for C++ is
> > because you want to write complex code bases then you are in the wrong
> > community and should leave as fast as you can.
> >
> > By adding constraints on the hidden complexity it is by cause made hard‐
> > er to write useless abstraction code.
>
> You cannot always simplify the problem to keep a simple solution, sometimes the
> problem *is* complex. I put safe guards in the code, especially when the have
> zero cost in release, because I have debugged enough clever C like code to
> prefer a compilation error or an assert failing as soon as possible to a long
> session in gdb.
Look at the suckless tools. If you really start from the beginning with
the intention to write complex code you will end up with complex code.
Split the problems up in tools: The Unix Philosophy. This is not your
commercial environment where you can’t afford to publish subsets before
you take tons of money from clients buying licenses from resellers, giv‐
ing nearly no support.
> > > > No generic is a feature. Generic are very stupid idea that only creates
> > > > blown binaries (this is one of the point I don't like about C11). Also,
> > > > the compexity of generics in a lenguage with automatic conversions
> > > > like C (and C++) is too much.
> > >
> > > what is silly is rewriting the same function with different arguments again
> > > and again. Or ending up relying on macros to emulate generics.
> >
> > Learn to code in C.
>
> What is your strategy in C when you need to apply the same logic on different types ?
That doesn’t happen that often to justify overloading. Hint: Avoided
complexity in the system *beforehand*.
> > > Get your complexity right, inserting in a dynamic array is O(n), the eventual
> > > need for an allocation is amortized (whereas you always end up doing a malloc
> > > for your linked lists). Another thing you should look up is modern cpu
> > > architectures and caches, in practice the much better locality of reference
> > > of arrays makes them *way* better on operation like insert/erase in the middle
> > > than lists even though complexity theory says otherwise. (Remember, complexities
> > > are asymptotic, you need huuuuuge number of elements).
> >
> > When you work close to the metal much of your theory can be optimized
> > out. I won’t tell you how.
>
> The best you can do is store your linked list in an array, and sort it at certain
> point so that elements end up linearly in memory. But when you've done that you
> already have a dynamic array implementation.
No, the best is to apply whichever data structure you need at the mo‐
ment. Discussing which array to use makes no sense without the actual
problem defined.
> > No, civilisation ended when »C++« was mentioned. Code abstraction and
> > bad design choices made from idiots relying on OOP are the reason why
> > your local Windows machine is so slow in loading drivers, opening Win‐
> > dows, loading the help file in the regular Java NULL pointer exception
> > or simply loading and displaying text in a webbrowser.
> > This can only be avoided by changing and restricting the system.
>
> I blame that on .net... More seriously, yep there is a lot of ugly C++ out
> there, and OOP nonsense, I've seen my share of extra deep class hierarchies
> with virtual methods everywhere. That code might have been written in C++,
> but its very far from idiomatic, modern C++. The ioccc tends to show that
> C is far from imune from unintelligile code.
You are too young, if you think .NET is the problem. The problem arose
before that with C++ in the Windows world and X11 in Unix. Let’s see
which wrong logic answer you will apply to the last argument.
Conclusion: You try to force your work experience into the suckless phi‐
losophy, which does not work due to different basic principles. Next you
are fail to accept that reading source code in Open Source is more im‐
portant than your abstraction of reusing code between hating and oppor‐
tunity‐seeking programmer groups in corporate lifes. Please come down
from your throne.
Sincerely,
Christoph Lohmann
Received on Wed Sep 17 2014 - 06:29:01 CEST
This archive was generated by hypermail 2.3.0
: Wed Sep 17 2014 - 06:48:07 CEST