What does HackerNews think of ewig?

The eternal text editor — Didactic Ersatz Emacs to show immutable data-structures and the single-atom architecture

Language: C++

#9 in C++
#12 in Emacs
You might be interested in ewig and immer by Juan Pedro Bolivar Puente:

https://github.com/arximboldi/ewig

https://github.com/arximboldi/immer

See the author instantly opening a ~1GB text file with async loading, paging through, copying/pasting, and undoing/redoing in their prototype “ewig” text editor about 27 minutes into their talk here:

https://m.youtube.com/watch?v=sPhpelUfu8Q

It’s backed by a “vector of vectors” data structure called a relaxed radix balanced tree:

https://infoscience.epfl.ch/record/169879/files/RMTrees.pdf

That original paper has seen lots of attention and attempts at performance improvements, such as:

https://hypirion.com/musings/thesis

https://github.com/hyPiRion/c-rrb

Ewig is an interesting implementation using immutable data structures. https://github.com/arximboldi/ewig Very proof of concept, tries to be a little emacs like. Might be worth checking out.
For another approach: I built a didactic text editor to teach "value oriented design" and immutable data-structures in C++:

https://github.com/arximboldi/ewig

It's design is covered in these talks:

- Postmodern immutable data structures: https://www.youtube.com/watch?v=sPhpelUfu8Q

- The most valuable values: https://www.youtube.com/watch?v=_oBx_NbLghY

Hey. Check out Juan Pedro Bolivar Puente's talks om value oriented design. He worked on Ableton which is a large application. He specifically speaks to Undo. He describes a much better pattern than the Command Pattern.

He also released his source for Value Oriented Data structures

Juan Pedro is a next level programmer who I think has pushed the craft forward through his work on bringing Value Oriented Design into the C++ world.

Talk I https://youtu.be/sPhpelUfu8Q

Talk II https://youtu.be/SAMR5GJ_GqA

Data Structures: https://github.com/arximboldi/immer

Application Structure: https://github.com/arximboldi/lager

Text Editor: https://github.com/arximboldi/ewig

Good luck.

I haven't used this but watched a talk from the author about how it can load huge files really quickly and can even edit while saving. Sounds pretty god tier in terms of performance:

https://github.com/arximboldi/ewig

Check out the talks from Juan Pedro Bolivar Puente. They are truly next level imo.

That's a tricky question. Large C++ codebases often have a lot of "legacy" that does not necessarily reflect the best practices.

A couple of years ago I wrote a text-editor to have a realistic example of what I consider a nice modern architecture using immutable data-structures. In the README there is also a link to a talk where I cover some of the design and structure:

https://github.com/arximboldi/ewig

Libraries that it uses:

https://github.com/arximboldi/immer

https://github.com/arximboldi/lager

The language and notation is inconsistent with hundreds of years of use in maths and confusing for kids learning both maths and programming (at least it confused me).

Regarding your skeptism of immutable data structures, it's best to think of immutable data and data structures as copy-on-write instead of update-in-place. This is a technique that is currently very underused, for example most programming languages do not come with "persistent" copy-on-write collections.

Here is an example text editor built using immutable data structures in C++: https://github.com/arximboldi/ewig

Advantages are excellent support for concurrency (background save works while you edit) and trivial support for undo/redo.

The author has created a text editor which uses immutable data structures s.t. he can do fast undo / redo [1]

[1] https://github.com/arximboldi/ewig

I am working on something like that for C++, a library + debugger called Lager. Quite experimental yet, but been using it to write apps with SDL and Ncurses and I am happy with how it is going... In the end it is a very simple architecture, implementable in any language. Good immutable data-structures are important for big programs though.

Library: https://github.com/arximboldi/lager

Ncurses example (full text-editor): https://github.com/arximboldi/ewig

SDL example: https://twitter.com/sinusoidalen/status/939539173584916480

Immutable data: https://github.com/arximboldi/immer

(There was a talk about Lager at MeetingCpp this year, still waiting for it to be published online...)

My most popular open-source project [1] I talk about at conferences, mostly C++ ones (last example [2]). I was lucky to also land a paper about it at ICFP'17 [3]. On Friday I will talk at the MeetingCpp conference in Berlin about a new library I am building (kind of experimental Redux for C++ with time-travelling debugger!).

I work as a freelancer and at the moment I do client work 3 days a week and dedicate the rest of the time to the open-source work. The open-source work includes doing research and implementing these tools, but also preparing the talks, which is a very time consuming task for me. Doing conference talks is very emotionally exhausting, I dread the previous weeks to the talk---but the feeling afterwards is very good and it is a good way to get exposure, I hope.

My dream is to some day form a social company with a coop structure that works full-time on open-source, either directly or indirectly helping clients use these tools in their system. I hope I am set up in the right direction.

Recently I opened a Twitter account to talk mostly about my open-source stuff [1]. I admittedly hate Twitter as a social network, but I've been convinced that it is a good place for networking in our industry, so I just play the game.

I keep telling myself that I should open blog too, but then I realize that one can't simply do everything all the time, so I guess maybe I'll never do it.

To your last question: is it unfair to not do marketing to your work? Totally not. Just do whatever feels right to you. If one day you realize you have built something really useful, probably you'll get the urge to tell people about it.

[1] Immutable data-structures for C++: https://github.com/arximboldi/immer

Example usage: https://github.com/arximboldi/ewig

[2] https://www.youtube.com/watch?v=sPhpelUfu8Q

[3] https://public.sinusoid.es/misc/immer/immer-icfp17.pdf

[4] https://twitter.com/sinusoidalen

Very interesting work! It seems that educational text editors are becoming a trend after Antirez published his :-)

Excuse me the shameless plug, I'd like to show mine too: https://github.com/arximboldi/ewig

It is written in C++, but using a style that is unlike what most C++ developers use: it is composed mostly of pure functions. The architecture is very much like that of Elm programs, and there is even a `store` class like in Redux.

Like the project from OP, it is about 2K lines of code. But it also supports asynchronous loading/saving, copy-paste (you can copy-paste a 1GB file instantly), very robust undo, dirty markers, UTF-8 (not perfect), etc.

The magic? Immutable vectors based on RRB-Trees. This is like the vectors in Clojure/Scala, but also supports log(n) slicing, concatenations, insertions---these operations are fundamental for a text editor, and I'd say, to most interactive software supporting big data models [1].

The code has been written in a style as simple as I could. I'd like to think that even non-C++ developers might be able to understand it. It might be specially interesting for web developers invested in Clojure, Elm or Redux and the single-atom architecture.

Probably one day I should go ahead and just write a blog post about it or a tutorial or something. But so far I don't have a blog I am not really a social media person. The code is still moving also...

PS. And thanks a lot to @kostspielig her help writing and reviewieng the code! <3

[1] The data-structure can be found here: https://github.com/arximboldi/immer