Writing An Editor In Elixir -- Elixir for GUIs? Yes, it’s possible. I’m working on a modern editor in Elixir, and I’ll show you how I’m doing it. Topics will include GUI libraries for Elixir, ports, NIFs, interfacing Elixir with other languages (especially Rust), and general design principles for a modern, programmable editor. https://elixirforum.com/t/14-elixirconf-2017-writing-an-editor-in-elixir-ian-duggan/8950 https://www.youtube.com/watch?v=6lIVWVmuPao Github: https://github.com/ijcd Twitter: @ijcd San Francisco, California SPEAKER NOTES: ------------- Why Design UI Tips I’ve always had an off fascination with editors. The answer, I believe, as to what makes a good editor, is when it makes us more productive. When it allows us to get into a flow. When it gets out of the way and just lets us create. I have a theory that, for some, it’s what makes you most productive quickly (TextMate, Sublime, Atom) For others, it is what you can control deeply (Emacs, Vi, Atom?). But if they are so hard to learn, why do they persist? Power... the power to control your environment (a true hacker wants to control everything... quote? reference?). But... why don’t people just add to Sublime/Atom/TextMate, etc... because of friction. My hypothesis is that the reason Emacs is so powerful, is that you can write emacs in emacs without leaving it it can grow as you use it. Others can too, to some extent, but not to the deep level of customizability you can get from Emacs... Not even vim can do this (which is why Spacemacs exsists... some people want the keys of vi with the features of emacs)... This editor had lisp embedded. It could read email and netnews before your cellphone could make phone calls without being attached to a car. You could customize it, from the very beginning. DECADES AGO. New editors are adding most of its features, except for the ability to CODE ITSELF WHILE RUNNING. Why is this a good idea? 1. Emacs <-> Vixen 2. C core, Elisp control <-> Rust core, Elixir control 3. Elisp <-> Elixir 4. Dynamic <-> Dynamic 5. Runtime eval <-> Runtime compile (hot code reload) 6. Macros <-> Macros 7. DSLs <-> DSLs 8. concurre-what? <-> concurrency 9. immuta-maybe? <-> immutable 10. beachballs <-> no beachballs (if designed well) Rust stuff might mess up your schedulers, Elixir string manipulations might cause GC issues — you need to profile and make a choice. That said, this is an editor and we are using Elixir more for the flexibility than the performance... Some issues around signals, detecting window size (in escripts) Use tty like iex (have user_drv open it), anoint self as shell Very much like unix. A process has a process group. IO is sent to the process group session leader. erlang:display goes around this. editor in control Rust/Termion ruby rust can launch w/out shell and insert ourselves as one can multiplex the shell in our own buffer pty/port-driver combo Telnet Port Driver