Threads for FrostKiwi

  1. 2

    One more step towards a more open interaction between FOSS and historically hostile companies. Really happy this is happening.

    1. 4

      This is neat! But it takes as input a UTF-16 character (wchar_t), when in my experience nearly all Unicode text is encoded as UTF-8*. So that would require an additional step to decode 1-4 UTF-8 bytes to a Unicode codepoint. (Not sure what one does with codepoints above FFFF, where stuff like emoji lives — maybe there are no alphabets up there?)

      It’d be cool to have an algorithm that directly read and wrote UTF-8. I imagine there’s one out there already somewhere.

      * Obj-C’s NSString uses UTF-16 in its API, but I know it internally stores the string in several encodings including ASCII to save space; not sure if it uses UTF-8. (Swift went to an internal UTF-8 representation.) I hear Windows APIs use UTF-16? Mostly UTF-16 seems like a relic from the period before the Unicode architects realized that 65536 characters wasn’t enough for everything.

      1. 1

        Not sure what one does with codepoints above FFFF, where stuff like emoji lives — maybe there are no alphabets up there?

        There are, so this is not a “Unicode-complete” solution, but probably good enough for many use-cases.

        1. 1

          Additionally, there are a bunch of late addition and corrections for the CJK block. 叱 53F1 vs 𠮟 20B9F being a notable example.

        2. 1

          Utf16 is a good choice for where the code comes from - wine which need to deal with windows API which is mostly utf16.

          1. 1

            This was for a Windows project. Platform API is entirely in UTF-16. UTF-8 version would probably require multi-level lookup tables, but these should be compressible along the same lines.

          1. 5

            I’ve been playing with Dear ImGui recently. The documentation is terrible and probably should be listed in the ‘cons’, but the good news is that the abstractions are so simple that it doesn’t really need them. I’ve been using the ImTui back end, which renders with ncurses. There’s also one for rendering via WebSocket to a browser, along with many others for displaying in a more conventional GUI. I’d probably list a couple of other cons:

            • No accessibility features (yet - I think it’s planned)
            • No native look and feel (it’s mostly used in games, where this doesn’t matter)
            • Still a fairly young / small project, so lacks things like rich text layout APIs that you’d find in a more mature project.

            The docs spend so much time telling you what an immediate mode GUI isn’t that they forget to tell you what it is. Coming from OpenStep, I expected to hate it and I’ve been really surprised at how much I’ve enjoyed programming with it. The idea behind an immediate-mode GUI is that you treat the GUI as stateless. Each frame, you call a function for each control, which creates the control if it doesn’t exist and tells you if the user interacted with it. The framework is free to cache things between frames (and probably needs to for performance) but this means that memory management is trivial. In the framework, there’s a map from control identifiers to controls, at the end of the frame any controls that weren’t referenced can be deleted. Outside of the framework, there are no references to controls held by your code and no references to your code held by the framework.

            Rather than building a hierarchy of objects that represent controls, you execute code that builds the controls each frame. If you want a new window, you call a begin-window function, then a load of other functions that build controls in that window, and then end-window. Similarly, if you want any other kind of container view, you call a start function, then call functions to create things inside the list, then an end function. All of the functions that define containers (windows, tabs, combo boxes, and so on) return true if the thing is visible, false otherwise. This means that you can skip all of the code that displays things that aren’t visible.

            If you want two different controls to bind to the same data, read from the data source when you instantiate them. If the user interacts with either control, you will be notified (by the return value) when you create the control for the next frame and so you can update the data source then and it will be propagated to any controls drawn later in the frame and into all controls in the next frame.

            All of this completely eliminates most of the complexity of MVC frameworks. You write functions that take on the complete roll of a controller, with a very narrow interface to the views. Each frame they (logically) create the view and write back to the model if anything has changed. If you call a view function to create a control then any notification of state changed (button pressed, slider moved, text entered in text field, and so on) will be provided either by the return value or by a callback that’s invoked on the top of the stack, so your state management is trivial.

            The immediacy of the feedback means that you don’t need to track any state. The shape of your GUI directly reflects the shape of the code and any bit of your model that you’re reading to display is the same bit that you’d update for changes from the UI. If you want to display a load of items in a tree / outline view, then you’ll probably have a recursive function call for each layer in the tree and then a loop inside it for displaying each item at a given level. If you put buttons there and the user clicks one then the function that creates the button will return true and you can handle at at the point where you’re already traversing that bit of your data structure.

            1. 5

              Big fan of immediate mode GUIs and contributor to Nuklear.

              No accessibility features

              One of the big hurdles of most non-native GUI toolkits, not just the IMGui variants. Doing this properly can be done, but ohh dear is it a big chunk of work. Not exactly accessibility per se, but smaller steps like improving the multi language input was the missing piece in my use-case. As long as you stick to a use-case where being accessible isn’t required (Embedded, machine touchscreens), intermediate mode GUIs are a god send. PS: Mainstream screenreaders for the visually impared have an OCR fallback, though this is no excuse of course.

              Still a fairly young / small project

              Even with all the crazy industry support Dear IMGui pulled in, this will always be the case. It’s a fairly niche style to program. When I tell seniors “this paradigm mixes code on GUI definitions in a very pleasant way” they take out a crucifix and try to repell the sinful idea of mixing code like I’m the devil himself. MVC is the standard I learned in uni and will never leave bigger team sizes, I think.

              All of this completely eliminates most of the complexity

              When doing very complex layouts, IMGui can backfire hard. Straight shotgun to the foot, as you start to re-implement all that state and abstractions you got rid of in the first place. But for anything with a more straight forward purpose, simpler design, the IMGui style is unparalleled in simplicty and comfort. Niche, but when it fits, it’s glorious.

              1. 1

                Big fan of immediate mode GUIs and contributor to Nuklear.

                I had a brief look at Nuklear but when it said that it used ANSI C89 I ran away.

                MVC is the standard I learned in uni and will never leave bigger team sizes, I think.

                That’s definitely true now, although model-view-update is increasingly fashionable and I think immediate-mode GUIs fit that model very cleanly.

                When doing very complex layouts, IMGui can backfire hard. Straight shotgun to the foot, as you start to re-implement all that state and abstractions you got rid of in the first place. But for anything with a more straight forward purpose, simpler design, the IMGui style is unparalleled in simplicty and comfort. Niche, but when it fits, it’s glorious.

                I haven’t reached that point yet, but creating a tree view containing a row of different views that all update the part of the data structure that they’re expanding is an order of magnitude less code than it is with Cocoa / GNUstep. My normal litmus test for a GUI toolkit is whether it can smoothly scroll a table view with ten million rows. I haven’t tried that with Dear ImGUI yet. I presume that I’d need to draw the visible rows myself, which is fairly easy if it can tell me which ones need to be visible. GNUstep does a bit of caching here, rendering more rows and clipping. I believe Cocoa now renders a larger range to a texture and just composites it in the right place.

                1. 1

                  ANSI C89

                  You may use it from any C or C++ standard. The C89 thing was originally done by vurtun back in the day to ensure compatibility with even the most obscure embedded compiler. Since most of the work was done, the C89 thing was kept going to keep that quite unique part of this project. Some of the C stuff to make it happen are quite interesting and were mentioned in C related articles from time to time.

                  model-view-update

                  Ohh, didn’t know such a thing existed. Gonna read up on it, thanks!

              2. 2

                is there a layout engine that computes (and re-computes) relative positions on controls when screen window gets resized?

              1. 4

                I wonder how it looks if you are typing in several languages.

                If I remember correctly, some of those layouts are tuned specifically for English.

                1. 8

                  I wonder how it looks if you are typing in several languages.

                  It’s bad. And it always will be. I typed on german QWERTZ for most of my life and for programming it’s pain. alt gr + 7 to type { is insane. That’s why the fun intersection between German and Programming Neo2 was invented. I was born in Belarus and work for a Japanese company. QWERTY’s Y and Z being so far apart is aweful for the ず and ゆ in QWERTY-Japanese and when writing Russian without mnemonic / translit I stumble when trying to remember where the hell ё went.

                  There is no “one to rule them all” and never will be I think. You either learn the native optimized layout or have to live with your WPM cut in half.

                  1. 4

                    Yes, that matches my experience, and is why the Layout Wars seem a bit odd to me.

                    I have more trouble switching layouts, so I have a custom one that works for all the languages I use regularly, but is probably far from ideal for any one of them.

                1. 17

                  Its package ecosystem is in excellent condition and packages such as org-mode and eglot / lsp-mode make even the most demanding programming languages a joy to work with in Emacs.

                  I work on a large C/C++ codebase as part of my day job and use lsp-mode/eglot (currently eglot) to navigate the code, with very few extensions. I also use the latest mainline Emacs with native compilation. I have been using Emacs for over 25 years and my customization is best categorized as “very light”. In short, my Emacs set up is not much beyond what ships with it.

                  And it’s still just… slow. GCC has some pretty big files and opening them can take up to 10 seconds thanks to font-lock mode. (Yes, I know I can configure it to be less decorative, but I find that decoration useful.) It’s much worse when you open a file that is the output from preprocessor expansion (easily 20000+ lines in many cases).

                  Log files that are hundreds of megabytes are pretty much a guaranteed way to bring Emacs to a crawl. Incremental search in such a buffer is just painful, even if you M-x find-file-literally.

                  I had to turn off nearly everything in lsp-mode/eglot because it does nothing but delay my input. I can start typing and it will be 3-4 characters behind as it tries to find all the completions I’m not asking for. Company, flymake, eldoc are all intolerably slow when working with my codebase, and I have turned them all off or not installed them in the first place.

                  M-x term is really useful, but do not attempt to run something that will produce a lot of output to the terminal. It is near intolerable. Literally orders of magnitude slower to display than an xterm or any other terminal emulator. (M-x eterm is no better.)

                  The problem, of course, is that Elisp is simply not performant. At all. It’s wonderfully malleable and horribly slow. It’s been this way since I started using it. I had hopes for native compilation, but I’ve been running it for a few months now and it’s still bad. I love Emacs for text editing and will continue to use it. I tried to make it a “lifestyle choice” for a while and realized it’s not a good one if I don’t want to be frustrated all the time. Emacs never seems to feel fast, despite the fast hardware I run it on.

                  1. 6

                    The performance was the reason for me to leave Emacs. I was an evil mode user anyways so the complete switch to (neo)Vim was simple for me. I just could not accept the slowness of Emacs when in Vim everything is instant.

                    E.g. Magit is always named as one of the prime benefits of Emacs. While its functionality is truly amazing its performance is not. Working on a large code base and repository I was sometimes waiting minutes! for a view to open.

                    1. 3

                      What did you find slow on Emacs aside from Magit?

                      I actually use Emacs because I found it really fast compared to other options. For example, the notmuch email client is really quick on massive mailboxes.

                      Some packages might be slow, though. I think the trick is to have a minimal configuration with very well chosen packages. I am particularly interested in performance because my machine is really humble (an old NUC with a slow SATA disk).

                      1. 2

                        To be fair it was some time ago and I don’t remember all the details but using LSPs for code completion/inspection was pretty slow e.g.

                        Compared to IDEs it might not even have been slow but similar. I however have to compare to Vim where I have equal capabilities but pretty much everything is instant.

                        My machine was BTW pretty good hardware.

                        1. 1

                          lsp-mode became much more efficient during the last year or so. Eglot is even more lightweight, I think. Perhaps it is worth giving it another go.

                          I think there was some initial resistance to LSP in the Emacs community and therefore they were not given the attention they deserve.

                          1. 2

                            Thanks for the notice! I may try it again in the future but currently I am very happy with my Neovim setup, which took me a long time to setup/tweak :)

                      2. 2

                        Out of curiosity, were you using Magit on Windows?

                        I use Magit every day and my main machine is very slow. (1.5GHz 4 core cortex A53) Magit never struck me as particularly slow, but I’ve heard that on Windows where launching subprocesses takes longer it’s a different story.

                        1. 3

                          but I’ve heard that on Windows where launching subprocesses takes longer

                          Ohh you have no idea how slow in a corporate environment. Going through MSYS2, Windows defender, with windows being windows and a corporate security system on top, it takes… ages. git add a single file? 20 seconds. Create a commit? Over a minute. It’s bonkers if you hit the worst case just right. (On a private Windows install, MSYS2 + Exceptions set in Windows Defender it’s fine though, not much slower as my FreeBSD laptop) I asked around and there is a company wide, hardcoded path on every laptop, that has exceptions in all the security systems just to make life less miserable for programmers. Doesn’t solve it completly, but helps.

                          Either wait an eternity or make a mokery of the security concept. Suffice to say I stopped using Windows and Cross-Compile from now on.

                          1. 1

                            Can confirm. I use Magit on both Linux and Windows, and it takes quite a bit of patience on Windows.

                            1. 1

                              With Windows I think it’s it’s particularly git that is slow, and magit spawns git repeatedly. It used also to be very slow on Mac OS as well because of problems with fork performance. On linux, it used to be slow with tramp. There are some tuning suggestions for all of these in the magit manual I think.

                              1. 1

                                Nope on Linux. As mentioned our code base is big and has many branches etc. Not sure where exactly Magit’s bottleneck was. It was quite some time ago. I just remember that I found similar reports online and no real solution to them.

                                I now use Lazygit when I need something more than git cli and it’s a fantastic tool for my purpose. I also can use it from within Vim.

                              2. 1

                                Working on a large code base and repository I was sometimes waiting minutes! for a view to open.

                                This happens for me as well with large changes. I really like Magit but when there are a lot of files it’s nearly unusable. You literally wait for minutes for it to show you an update.

                              3. 4

                                I know you’re not looking to customise much but wrt. terminals, vterm is a lot better in that regard.

                                1. 1

                                  I actually switched to M-x shell because I found the line/char mode entry in term-mode to be annoying (and it seems vterm is the same in this respect). shell-mode has all the same slowness of term-mode, of course. I’ve found doing terminal emulation in Emacs to be a lost cause and have given up on it after all these years. I think shell-mode is probably the most usable since it’s more like M-x shell-command than a terminal (and that’s really its best use case).

                                  1. 1

                                    If you need ansi/curses there’s no good answer and while I like term it was too slow in the end and I left. I do think that for “just” using a shell that eshell is fine though.

                                2. 3

                                  Do you use the jit branch of emacs? I found once I switched to that and it had jit compiled things my emacs isn’t “fast” but its pretty boring now in that what used to be slow is now at least performant enough for me not to care.

                                  1. 2

                                    Is there a brew recipe or instructions on compiling on Mac? Or does checking out the source and running make do the business?

                                    1. 3

                                      I use the emacs-plus1 package. it compiles the version you specify. currently using emacs-plus@29 with --with-native-comp for native compilation, and probably some other flags.

                                      1. 2

                                        Thanks again, this is appreciably faster and I’m very pleased 😃

                                        1. 2

                                          Awesome! also, check out pixel-scroll-precision-mode for the sexiest pixel-by-pixel scrolling. seems to be a little buggy in info-mode, can’t replicate with emacs -Q though, so YMMV.

                                        2. 1

                                          Thank you that sounds perfect

                                        3. 1

                                          I’m a Mac user and I found it very hard to compile Emacs.

                                          This might be a good starting point however:

                                          https://github.com/railwaycat/homebrew-emacsmacport

                                          1. 1

                                            I honestly don’t know I use nix+home-manager to manage my setup on macos, this is all I did to make it work across nixos/darwin:

                                            Added it as a flake input: https://github.com/mitchty/nix/blob/7e75d7373e79163f665d7951829d59485e1efbe2/flake.nix#L42-L45

                                            Then added the overlay nixpkgs setup: https://github.com/mitchty/nix/blob/7e75d7373e79163f665d7951829d59485e1efbe2/flake.nix#L84-L87

                                            Then just used it like so: https://github.com/mitchty/nix/blob/6fd1eaa12bbee80b6e80f78320e930d859234cd4/home/default.nix#L87-L90

                                            I gotta convert more of my config over but that was enough to build it and get my existing ~/.emacs.d working with it and speedy to the point I don’t care about emacs slowness even on macos anymore.

                                          2. 1

                                            Do you use the jit branch of emacs?

                                            Yes. I’ve been using the libgccjit/native compilation version for some time now.

                                          3. 2

                                            The problem, of course, is that Elisp is simply not performant.

                                            That’s half of it. Another half is that, IIRC, Emacs has rather poor support for asynchrony: most of elisp that runs actually blocks UI.

                                            1. 1

                                              In short, my Emacs set up is not much beyond what ships with it.

                                              Can share your config? I’m curious to know how minimal you made it.

                                              1. 1

                                                Here you go. It changes a little bit here and there with some experiments.The packages I currently have installed and use are: which-key, fic-mode, counsel, smartparens, magit, and solarized-theme. There may be a few others that I was trying out or are only installed for some language support (markdown, yaml, and so forth).

                                                1. 1

                                                  Thank you very much.

                                                2. 1

                                                  Quick addendum on the config: that’s my personal config, which morphs into my work setup. My work one actually turns off flymake and eldoc when using eglot.

                                                3. 1

                                                  Is there anything that has prevented a Neovim-style rewrite of Emacs? A Neomacs?

                                                  I keep hearing about the byzantine C-layer of Emacs and the slowness of Elisp. And Emacs definitely has the community size to develop such an alternative. Why do you think no one has attempted such an effort? Or maybe I should add “recently” to the question. As I know there are other Emacs implementations.

                                                  1. 4

                                                    As crusty as Emacs source can be, it’s nowhere near as bad Vim source was, which was a rat’s nest of #ifdef. That’s why Neovim had to basically rewrite their way to a fork. The Emacs implementation is surprisingly clean, as long as you can tolerate some of the aged decisions (and GNU bracing).

                                                    1. 2

                                                      There is Climacs, which isn’t exactly the same, but is close.

                                                      The problem for any new Emacs clone will that it has to run all the Elisp out there. Unless there is a substantial speed improvement to Elisp or a very good automatic translation tool, any such project will be doomed from the start.

                                                  1. 4

                                                    FreeBSD is my daily driver. But I’m still baffled, that C-States deeper than C1 are disabled by default. hw.acpi.cpu.cx_lowest is set to C1 after install and the first thing I do is set it to CMAX. ( The OS itself can only set C3 and the hardware goes lower, enabling features like Coreparking and so on, which is invisible to the FreeBSD Kernel without kernel modules to detect lower C-states. ) The reason for only C1 by default is historically C6 / CoreParking being possibly buggy I guess?

                                                    Either way, on my dual 16 core Opteron server simply allowing them to go into AMD’s “CC6” and park their cores cuts system powerdraw by 20 something Watts on idle. (Holy smokes that architecture is inefficient) On a laptop is of course not as dramatic, but I’m still confused why a more sensible default isn’t … default.

                                                      1. 1

                                                        Great write-up! Didn’t know even ZFS had a performance related tweak. Tuning filesystems for power efficency is kind of insane as a concept. There should be an official laptop.sh enabling all the sane defaults to make FreeBSD less daunting outside of the server use-case.

                                                        In May I want to do one of these again and make a proper powerdraw measurement with the battery removed in idle + watching a YouTube video compared to Windows, Linux vs FreeBSD in it’s default state vs going through a guide like yours. Especially interested in Powerdraw with Intel’s Turbo-Bias setting for the YouTube video use-case. For work I received a ZBook Fury G7 (i7-10750H, NVIDIA Quadro T2000) and it should be a good benchmark of a modern system without jumping into modern unknowns like Big/Little chips with their performance cores and an NVIDIA GPU is present to test compare how true wezm’s observation is on other systems.

                                                        1. 2

                                                          Thanks.

                                                          Good idea about laptop.sh script :)

                                                          1. 1

                                                            It would be nice to periodically poll the sysctl that exposes whether you’re on battery or mains power and toggle between the different configuration options. I’m quite happy for my laptop to consume power when it’s connected to a wire.

                                                      2. 2

                                                        The reason for only C1 by default is historically C6 / CoreParking being possibly buggy I guess?

                                                        As I recall, all of this requires poking ACPI tables and a lot of these were spectacularly buggy. I had a ThinkPad that, if you took it into lower sleep states, would then leave the CPU at a crazily low CPU speed (something like 10% of the default) when you came back, some of the time. Even Windows didn’t come with work arounds for this out of the box, so you needed to reboot if this happened. I believe Lenovo later released a driver that worked around this in some way. Additionally, I think some of the deeper states required that all drivers also be aware of the sleep state because they would affect other things on the SoC or even the rest of the motherboard.

                                                        I have no idea whether more recent hardware has these problems or whether FreeBSD now has better work-arounds. I think OpenBSD has done a lot of work in this area (it was a running joke that OpenBSD had great support for suspend, they just needed to get resume working, and that motivated some of their hackers to put in a lot of effort to make things work smoothly).

                                                        1. 1

                                                          The sleep functionality of most brands of 86 motherboards over the years hasn’t been great. Even Windows doesn’t really do it all that well on most non-Surface devices. The only reliable combinations for sleep/resume has been all-Apple or all-Microsoft stacks. So if I were doing OSS stuff I’d turn most of it off, too.

                                                          1. 2

                                                            Even Windows doesn’t really do it all that well on most non-Surface devices

                                                            Even there it’s not perfect. Windows 11 on the Surface Book 2 appears to have a bug where if you didn’t gracefully shut down the machine (i.e. on the first boot after a crash) it can’t take the CPU speed over about 1 GHz. Windows 11 on a 400 MHz CPU is very painful. Fortunately, an additional reboot seems to fix it for me, though booting and then shutting down with the CPU sitting at 400-700 MHz takes quite a long time.

                                                        1. 1

                                                          The fun and comfyness factor are important for my enjoyement of programming. I am guilty of having spent more time editing my .emacs than doing a task I was assigned to on certain days. But actually visually and interactivly enjoying my programming environment are an important factor to me and by extension, looking forward to interacting with my text editor makes me better at my job IMO.

                                                          Ligatures are such a factor. Ligatures, Hell yes.

                                                          1. 2

                                                            Author here. Just wanted to share how much of an insane help the subset command of the FontTools package has been to me and how I use it. It’s an awesome tool, that’s part of my Makefiles for embedded use-cases.

                                                            1. 5

                                                              Always enjoy these deep dives. As someone who has never looked below the surface of Shader code, the complexity of such magnitude is something I’m seriously happy to have abstracted away. Also my interactions with Jason Ekstrand have been nothing but great.

                                                              1. 2

                                                                One of the best write-ups I have seen on the topic. Not presenting one solution, but references to many other solutions to each problem along the way makes this a great resource.

                                                                1. 5

                                                                  I use them fairly extensively. There’s more to my layout that the web UI can’t encode (leader macros and the full expression of my macro keys), but that link has the major features.

                                                                  1. 3

                                                                    Do I read it correctly? - There are multiple Layouts on a single config (colemak, qwerty)? Years ago I tried learning the Neo 2 layout and the head work required to switch KBD layouts is already tough to me. But keeping two active at once… that’s beyond tough. What’s the benefit?

                                                                    Also the dedicated Emacs key get’s big love from me.

                                                                    1. 3

                                                                      Yeah there’s a qwerty fallback layer. It’s mostly for games that don’t let me remap them (there are a SURPRISING number of games that fall into this category). I don’t type in qwerty, I type in colemak mod-dh. Having a qwerty escape hatch can be uber convenient when you need it. :)

                                                                  1. 5

                                                                    Do I understand the purpose of the library correctly?

                                                                    A library like https://github.com/antirez/sds gives you dynamic memory management similar to C++ strings, but does not provide you with the ability to discern Unicode user-perceived characters. In contrast, libgrapheme assumes you already handle the memory management part like allocating strings and provides functions to discern and work on user-perceived characters as defined by the unicode. These two (sds + libgrapheme) libraries have two different purposes and can be used together for a more complete string processing package.

                                                                    1. 6

                                                                      Your observation is correct. You can pass both length- and NUL-delimited strings to libgrapheme-functions. Given SDS strings are NUL-terminated (as far as I understand they store metadata after the NUL-byte), you can simply pass a sds directly to any libgrapheme-function. The detection of user-perceived characters happens two layers above the basic byte-level that sds provides: First you have to decode UTF-8 (or any other encoding) to obtain codepoints, which in turn need to be analyzed to detect those spots where there is a character break (i.e. grapheme cluster break). libgrapheme gives you, for ease of use, the byte-offset of such breaks directly, so you’ll never have to work with codepoints and grapheme clusters as new data structures.

                                                                    1. 1

                                                                      Ahh damn, no support for 1-channel Grayscale… …great format, but that knocks it out of my use-case.

                                                                      1. 5

                                                                        Yay, I’ve been using this branch for months to get the Wayland scaling and I’ve had zero problems.

                                                                        1. 7

                                                                          I think that Wayland support is so important that they should cut ASAP Emacs 29 just for it, but probably we’ll have to wait a couple more years for a “stable” release.

                                                                          1. 3

                                                                            Curious what your use case for Wayland is?

                                                                            1. 21

                                                                              I am a Wayland user with a boring desktop use case. I like the:

                                                                              • Fractional DPI scaling (I have a 27” 4K monitor that I like to have somewhere between 1.25x and 1.5x)
                                                                              • Handling of multiple monitors (I have monitors with different desired DPIs and refresh rates)
                                                                              • Lack of screen tearing even with the aforementioned refresh rate mismatch (X11 multihead gives you a single Screen with numerous Displays that view the screen, so you can’t really do VSync with mismatched refresh rates that aren’t simple multiples of each other)
                                                                              • (What feels like?) lower latency: Compositors on X seem to do a lot of copies but Wayland applications seem to have a culture of dmabuf and it seems to make my experience of wayland much snappier when compared to X11 with compton/picom or something.
                                                                              1. 2

                                                                                I feel that last point. When using X11, it feels like I have a choice between no compositor (and the lack of features and slightly buggy rendering that entails) and compton (with the very bad performance that entails). Workspace switching with i3 would make the every OpenGL window look initially blank before it pops in half a second later when using compton.

                                                                                Sway, on the other hand, Just Works.

                                                                                Everything else on that list is important too of course.

                                                                                1. 3

                                                                                  Curious: what specific features do you like about the compositors? I’ve personally found them completely useless.

                                                                                  1. 2

                                                                                    I don’t remember 100% since it’s a long time ago, but IIRC, a compositor was necessary for reducing screen tearing, and parts of the screen would sometimes fail to update properly without a compositor.

                                                                                    1. 2

                                                                                      Screen tearing is easier to avoid with a compositor (nothing to do) than without. And in my case, true transparency (this helps me to check if a window is focused, but also for eye candy).

                                                                                      1. 1

                                                                                        Even if you don’t care about shiny stuff like shadows, you don’t need damage.

                                                                                    2. 2

                                                                                      X can do all those things too, except maybe the refresh rate thing though, I’m not sure about that. It is a pity that applications are just rewriting in Wayland instead of fixing their bugs on X and maintaining full compatibility.

                                                                                      1. 5

                                                                                        X11 can’t really avoid screen tearing. There are lots of different hacks which each somewhat reduce tearing in certain situations, but I’ve yet to see an X11 system which doesn’t have at least some screen tearing in at least some circumstances – while I’ve yet to see a Wayland system with screen tearing issues.

                                                                                        Fractional scaling on X11 is a hack which partially works sometimes but doesn’t work perfectly.

                                                                                        We’re long overdue for an X11 replacement. We’ve been adding hacks upon hacks upon hacks for far too long, and the fundamental limitations are really starting to show. It’s not enough to “just fix application bugs on X”. Screen tearing by itself is enough reason to throw X11 in the garbage and start fresh with something that’s actually reasonably well designed.

                                                                                        1. 1

                                                                                          As far as I understand, X cannot have different fractional scaling factors for different monitors, while Wayland can. It’s the main motivation for me to use Wayland, given I have a 1440p 25’ and 2160p 27’.

                                                                                        2. 1

                                                                                          I was always curious about fractional scaling. I thought that Wayland didn’t handle it (see https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/47). From my understanding, you are rendering at 2x, then downscaling. If you happen to have two monitors, this can be a lot of pixels to render.

                                                                                          1. 1

                                                                                            From my understanding, you are rendering at 2x, then downscaling.

                                                                                            This is how macOS does it, IIRC.

                                                                                            1. 1

                                                                                              I think there are non-mainline GDK protocols for it. At least all the non-XWayland applications I use look perfectly crisp

                                                                                          2. 12

                                                                                            For me personally, I use Wayland because it’s the only thing supported on my hardware (MNT Reform).

                                                                                            The only thing I use it for is to run XWayland so I can immediately launch Emacs and exwm, and then I run Firefox inside that.

                                                                                            At first glance it appears slower than using Wayland directly, but that’s only before you factor in the time you have to spend retrieving your laptop because you threw it out the window in rage because Firefox’s keybindings (when running outside exwm) are so bad and holding down C-n opened seventeen windows again instead of scrolling down.

                                                                                            1. 1

                                                                                              Doesn’t Firefox run directly with Wayland now?

                                                                                              1. 1

                                                                                                Probably, but if you run Firefox outside exwm there’s no way to fix the key bindings. The Firefox extension mechanism bans rebinding C-n and C-p for “security reasons”, making it completely unusable for me.

                                                                                                1. 1

                                                                                                  Supposedly it does https://twitter.com/omgubuntu/status/1379818974532280321?s=20, but I guess exwm doesn’t.

                                                                                                  1. 1

                                                                                                    Yeah. I guess exwm is the problem and not Firefox.

                                                                                                    1. 2

                                                                                                      No, the problem is that Firefox doesn’t allow the user to change some keybindings, like C-n. EXWM is the solution to that problem.

                                                                                                      1. 1

                                                                                                        It’s exactly this.

                                                                                                  2. 1

                                                                                                    For a while now already. Gotta define the MOZ_ENABLE_WAYLAND=1 env variable and it will start in Wayland mode. Have been doing this for 2(?) years now on Sway without issue. (Maybe the env thing is a thing of the past…)

                                                                                                    1. 2

                                                                                                      Sway + Firefox here as well. MOZ_ENABLE_WAYLAND=1 is no longer needed. Rejoice!

                                                                                                2. 8

                                                                                                  I’m surprised by your question. My (perhaps naive?) understanding is that the Xorg maintainers decided years ago that they don’t like the X protocol anymore for modern graphics stacks, that the stuff that was added on top of it is painful to design/implement/maintain, and that they wanted to start with something fresh with a more solid design. Wayland, as I understand it, this is “something fresh with a more solid design” (but its own protocols are still evolving and probably imperfect, as everything is.)

                                                                                                  With this understanding, if I have the choice to use both (that is, I’m not depending on worklows that are not supported on Wayland for fundamental reason (no support for easy forwarding) or due to lack of maturity), it seems natural to use Wayland. I want to use the new stuff that is the future and benefits from a growing userbase to mature (and benefit more users that currently have fewer options), and not the old stuff that keeps working but people dread maintaining.

                                                                                                  So: my use case is “moving to the new software stack that was designed from the start to be a better, more robust successor than the old software stack”.

                                                                                                  1. 6

                                                                                                    From my PoV Wayland is still in “second system redesign” territory like the early days of PulseAudio. Some people find it useful, some people like to help test the bleeding edge, but it’s not the default in anything I set up and since I’ve never had any issues with X I don’t currently go through the extra work to set it up. The only time I’ve worked with Wayland was to help my mom switch her computer back to X because some app was misbehaving under her Wayland setup.

                                                                                                    But if it’s working for you, that’s great of course. Just providing my PoV so hopefully my question is less surprising now.

                                                                                                    1. 3

                                                                                                      There is always a bias towards “not fixing what aint broken” so once you know a tool you’re likely to stick to it.

                                                                                                      That being said I don’t think wayland represents enough progress to consider it a successor to X, it’s a competitor for sure but I think by the time I move off X it won’t be to wayland.

                                                                                                      1. 5

                                                                                                        With most Linux distros gradually switching to Wayland and Windows adopting it as well for WSL, I think it’s fairly certain that Wayland is going to (mostly) replace X in the next 3-5 years. I doubt some other alternative will emerge before the transition to Wayland is complete.

                                                                                                  2. 5

                                                                                                    Desktops built on Wayland are amazing compared to desktops built on X11. I couldn’t go back anymore.

                                                                                              1. 6

                                                                                                Why another file manager? I wanted something simple and minimalistic, something to help me with faster navigation in the filesystem. A cd & ls replacement. So I build “llama”. It allows to quickly navigate with fuzzy searching, cd integration is quite simple. Opens vim right from llama. That’s it. Simple and dumb as a llama.

                                                                                                1. 6

                                                                                                  llama

                                                                                                  fuzzy search

                                                                                                  Will check it out for that alone.

                                                                                                  1. 0

                                                                                                    I think nnn also has that

                                                                                                    1. 1

                                                                                                      I meant the play on words :D

                                                                                                      1. 2

                                                                                                        Lol, took me a while to figure it out :D

                                                                                                  2. 5

                                                                                                    I think you should reconsider insulting llamas :-) They are not that dumb.

                                                                                                    1. 3

                                                                                                      Have you seen a llama face?)

                                                                                                      1. 3

                                                                                                        That’s not where the intelligence is stored.

                                                                                                        1. 0

                                                                                                          Yes, it’s behind and the dace is a mirror of intelligence.

                                                                                                    2. 3

                                                                                                      And I say, “Hey, Llama, hey, how about a little something, you know, for the effort, you know.” And he says, “Oh, uh, there won’t be any money, but when you die, on your deathbed, you will receive total consciousness.” So I got that goin’ for me, which is nice.

                                                                                                    1. 1

                                                                                                      Big fan. Unfortunately, being a second-class BSD citizen, we don’t have it, though there is some effort, seeing as there is a ports entry with an update dating to Apr 2021.

                                                                                                      1. 4

                                                                                                        This is an interesting thread on making Makefiles which are POSIX-compatible. The interesting thing is that it’s very hard or impossible, at least if you want to keep some standard features like out-of-tree builds. I’ve never restricted myself to write portable Makefiles (I use GNU extensions freely), but I previously assumed it wasn’t that bad.

                                                                                                        That this is so hard is maybe a good example of why portability to different dependencies is a bad goal when your dependencies are already open source and portable. As many posters in the thread say, you can just use gmake on FreeBSD. The same goes for many other open source dependencies: If the software is open source, portability to alternatives to that software is not really important.

                                                                                                        1. 4

                                                                                                          you can just use gmake on FreeBSD.

                                                                                                          I can, but I don’t want to.

                                                                                                          If you want to require any specific tool or dependecy, fine, that’s your prerogative, just don’t force your idea of the tool’s cost on me. Own your decision, if it impacts me, be frank about it, just don’t bullshit me that it doesn’t impact me just because the cost for you is less than the cost for me.

                                                                                                          The question of why don’t you use X instead of Y is nobody’s business but mine. I fully understand and expect that you might not care about Y, please respect my right not to care about X.

                                                                                                          1. 11

                                                                                                            That’s very standard rhetoric about portability, but the linked thread shows it’s not so simple in this case: It’s essentially impossible to write good, portable Makefiles.

                                                                                                            1. 5

                                                                                                              Especially considering how low cost using GNU Make is, over i.e. switching OS/architecture.

                                                                                                              1. 2

                                                                                                                It’s just as easy to run BSD make on Linux as it is to run GNU make on BSDs, yet if I ship my software to Linux users with a BSD makefile and tell them to install BSD make, there will hardly be a person who wouldn’t scorn at the idea.

                                                                                                                Yet Linux users expect BSD users not to complain when they do exact same thing.

                                                                                                                Why is this so hard to understand, the objection is not that you have to run some software dependency, the objection is people telling you that you shouldn’t care about the nature of the dependency because their cost for that dependency is different than yours.

                                                                                                                I don’t think that your software is bad because it uses GNU make, and I don’t think that using GNU make makes you a bad person, but if you try to convince me that “using GNU make is not a big deal”, then I don’t want to ever work with you.

                                                                                                                1. 2

                                                                                                                  Are BSD makefiles incompatible with GNU make? I actually don’t know.

                                                                                                                  1. 2

                                                                                                                    The features, syntax, and semantics of GNU and BSD make are disjoint. Their intersection is POSIX make, which has almost no features.

                                                                                                                    …but that’s not the point at all.

                                                                                                                    1. 2

                                                                                                                      If they use BSD specific extensions then yes

                                                                                                                2. 2

                                                                                                                  Posix should really standardize some of GNU make’s features (e.g. pattern rules) and/or the BSDs should just adopt them.

                                                                                                                  1. 5

                                                                                                                    I get the vibe at this point that BSD intentionally refuses to make improvements to their software specifically because those improvements came from GNU, and they really hate GNU.

                                                                                                                    Maybe there’s another reason, but why else would you put up with a program that is missing such a critically important feature and force your users to go thru the absurd workarounds described in the article when it would be so much easier and better for everyone to just make your make better?

                                                                                                                    1. 4

                                                                                                                      I get the vibe at this point that BSD intentionally refuses to make improvements to their software specifically because those improvements came from GNU, and they really hate GNU.

                                                                                                                      Really? I’ve observed the opposite. For example, glibc refused to adopt the strl* functions from OpenBSD’s libc, in spite of the fact that they were useful and widely implemented, and the refusal to merge them explicitly called them ‘inefficient BSD crap’ in spite of the fact that they were no less efficient than existing strn* functions. Glibc implemented the POSIX _l-suffixed versions but not the full set from Darwin libc.

                                                                                                                      In contrast, you’ll find a lot of ‘added for GNU compatibility’ functions in FreeBSD libc, the *BSD utilities have ‘for GNU compatibility’ in a lot of places. Picking a utility at random, FreeBSD’s du [has two flags that are listed in the man page as first appearing in the GNU version], whereas GNU du does not list any as coming from BSDs (though -d, at least, was originally in FreeBSD’s du - the lack of it in GNU and OpenBSD du used to annoy me a lot since most of my du invocations used -d0 or -d1).

                                                                                                                      1. 2

                                                                                                                        The two are in no way mutually exclusive.

                                                                                                                      2. 1

                                                                                                                        Maybe there’s another reason, but why else would you put up with a program that is missing such a critically important feature and force your users to go thru the absurd workarounds described in the article when it would be so much easier and better for everyone to just make your make better?

                                                                                                                        Every active software project has an infinite set of possible features or bug fixes; some of them will remain unimplemented for decades. glibc’s daemon function, for example, has been broken under Linux since it was implemented. The BSD Make maintainers just have a different view of the importance of this feature. There’s no reason to attribute negative intent.

                                                                                                                        1. 1

                                                                                                                          The BSD Make maintainers just have a different view of the importance of this feature

                                                                                                                          I mean, I used to think that too but after reading the article and learning the details I have a really hard time continuing to believe that. we’re talking about pretty basic everyday functionality here.

                                                                                                                        2. 1

                                                                                                                          Every BSD is different, but most BSDs are minimalist-leaning. They don’t want to add features not because GNU has them, but because they only want to add things they’ve really decided they need. It’s an anti-bloat philosophy.

                                                                                                                          GNU on the other hand is basically founded in the mantra “if it’s useful then add it”

                                                                                                                          1. 6

                                                                                                                            I really don’t understand the appeal of the kind of philosophy that results in the kind of nonsense the linked article recommends. Why do people put up with it? What good is “anti-bloat philosophy” if it treats “putting build files in directories” as some kind of super advanced edge case?

                                                                                                                            Of course when dealing with people who claim to be “minimalist” it’s always completely arbitrary where they draw the line, but this is a fairly clear-cut instance of people having lost sight of the fact that the point of software is to be useful.

                                                                                                                            1. 4

                                                                                                                              The article under discussion isn’t the result of a minimalist philosophy, it’s the result of a lack of standardisation. BSD make grew a lot of features that were not part of POSIX. GNU make also grew a similar set of features, at around the same time, with different syntax. FreeBSD and NetBSD, for example, both use bmake, which is sufficiently powerful to build the entire FreeBSD base system.

                                                                                                                              The Open Group never made an effort to standardise any of them and so you have two completely different syntaxes. The unfortunate thing is that both GNU Make and bmake accept all of their extensions in a file called Makefile, in addition to looking for files called GNUmakefile / BSDmakefile in preference to Makefile, which leads people to believe that they’re writing a portable Makefile and complain when another Make implementation doesn’t accept it.

                                                                                                                    2. 7

                                                                                                                      But as a programmer, I have to use some build system. If I chose Meson, that’d be no problem; you’d just have to install Meson to build my software. Ditto if I chose cmake. Or mk. Why is GNU make any different here? If you’re gonna wanna compile my software, you better be prepared to get my dependencies onto your machine, and GNU make is probably gonna be one of the easiest build systems for a BSD user to install.

                                                                                                                      As a Linux user, if your build instructions told me to install bsdmake or meson or any other build system, I wouldn’t bat an eye, as long as that build system is easy to install from my distro’s repos.

                                                                                                                      1. 3

                                                                                                                        Good grief, why is this so difficult to get through? If you want to use GNU make, or Meson, or whatever, then do that! I use GNU make too! I also use Plan 9’s mk, which few people have installed, and even fewer would want to install. That’s not the point.

                                                                                                                        The problem here has nothing to do with intrinsic software properties at all, I don’t know why this is impossible for Linux people to understand.

                                                                                                                        If you say “I am using GNU make, and if you don’t like it, tough luck”, that’s perfectly fine.

                                                                                                                        If you say “I am using GNU make, which can’t cause any problem for you because you can just install it” then you are being ignorant of other people’s needs, requirements, or choices, or you are being arrogant for pretending other people’s needs, requirements, or choices are invalid, and of course in both cases you are being patronizing towards users you do not understand.

                                                                                                                        This has nothing to do with GNU vs. BSD make. It has nothing to do with software, even. It’s a social problem.

                                                                                                                        if your build instructions told me to install bsdmake or meson or any other build system, I wouldn’t bat an eye, as long as that build system is easy to install from my distro’s repos.

                                                                                                                        And this is why Linux users do not understand the actual problem. They can’t fathom that there are people for whom the above way of doing things is unacceptable. It perfectly fine not to cater to such people, what’s not fine is to demand that their reasoning is invalid. There are people to whom extrinsic properties of software are far more important than their intrinsic properties. It’s ironic that Linux people have trouble understanding this, given this is the raison d’etre for the GNU project itself.

                                                                                                                        1. 5

                                                                                                                          I think the question is “why is assuming gmake is no big deal any different than assuming meson is no big deal?” And I think your answer is “those aren’t different, and you can’t assume meson is no big deal” but you haven’t come out and said that yet.

                                                                                                                      2. 1

                                                                                                                        I can, but I don’t want to.

                                                                                                                        Same. Rewriting my Makefiles is so annoying, that so far I have resigned to just calling gmake on FreeBSD. Maybe one day I will finally do it. I never really understood how heavily GNUism “infected” my style of writing software, until I switched to the land of the BSD.

                                                                                                                      3. 2

                                                                                                                        What seems to irk BSD users the most is putting gnuisms in a file called Makefile; they see the file and expect to be able to run make, yet that will fail. Naming the file GNUMakefile is an oft-accepted compromise.

                                                                                                                        I admit I do not follow that rule myself, but if I ever thought a BSD user would want to use my code, I probably would follow it, or use a Makefile-generator.

                                                                                                                        1. 4

                                                                                                                          I’d have a lot more sympathy for this position if BSD make was actually good, but their refusal to implement pattern rules makes it real hard to take seriously.

                                                                                                                          1. 2

                                                                                                                            I’d have a lot more sympathy for this position if BSD make was actually good

                                                                                                                            bmake is able to build and install the complete FreeBSD source tree, including both kernel and userland. The FreeBSD build is the most complex make-based build that I’ve seen and is well past the level of complexity where I think it makes sense to have hand-written Makefiles.

                                                                                                                            For the use case in mind, it’s worth noting that you don’t need pattern rules, bmake puts things in obj or $OBJDIRPREFIX by default.

                                                                                                                        2. 1

                                                                                                                          That this is so hard is maybe a good example of why portability to different dependencies is a bad goal when your dependencies are already open source and portable.

                                                                                                                          I mean, technically you are right, but in my opinion, you are wrong because of the goal of open source.

                                                                                                                          The goal of open source is to have as many people as possible using your software. That is my premise, and if it is wrong, the rest of my post does not apply.

                                                                                                                          But if that is the goal, then portability to different dependencies is one of the most important goals! The reason is because it is showing the user empathy. Making things as easy as possible for users is being empathetic towards them, and while they may not notice that you did it, subconsciously, they do. They don’t give up as easily, and in fact, sometimes they even put extra effort in.

                                                                                                                          I saw this when porting my bc to POSIX make. I wrote a configure script that uses nothing other than POSIX sh. It was hard, mind you, I’m not denying that.

                                                                                                                          But the result was that my bc was so portable that people started using on the BSD’s without my knowledge, and one of those users decided to spend effort to demonstrate that my bc could make serious performance gains and help me to realize them once I made the decision to pursue that. He also convinced FreeBSD to make my bc the system default for FreeBSD 13.

                                                                                                                          Having empathy for users, in the form of portability, makes some of them want to give back to you. It’s well worth it, in my opinion. In fact, I just spent two days papering over the differences between filesystems on Windows and on sane platforms so that my next project could be portable enough to run on Windows.

                                                                                                                          (Oh, and my bc was so portable that porting it to Windows was little effort, and I had a user there help me improve it too.)

                                                                                                                          1. 5

                                                                                                                            The goal of open source is to have as many people as possible using your software.

                                                                                                                            I have never heard that goal before. In fact, given current market conditions, open source may not be the fastest way if that is your goal. Millions in VC to blow on marketing does wonders for user aquisition

                                                                                                                            1. 1

                                                                                                                              That is true, but I’d also prefer to keep my soul.

                                                                                                                              That’s the difference. One is done by getting users organically, in a way that adds value. The other is a way to extract value. Personally, I don’t see Open Source as having an “extract value” mindset in general. Some people who write FOSS do, but I don’t think FOSS authors do in general.

                                                                                                                            2. 4

                                                                                                                              The goal of open source is to have as many people as possible using your software.

                                                                                                                              I actually agree with @singpolyma that this isn’t necessarily a goal. When I write software and then open source it, it’s often stuff I really don’t want many people to use: experiments, small tools or toys, etc. I mainly open source it because the cost to me of doing it is negligible, and I’ve gotten enough neat random bits and pieces of fun or interesting stuff out of other people’s weird software that I want to give back to the world.

                                                                                                                              On the other hand, I’ve worked on two open source projects whose goal was to be “production-quality” solutions to certain problems, and knew they weren’t going to be used much if they weren’t open source. So, you’re not wrong, but I’d turn the statement around: open source is a good tool if you want as many people as possible using your software.

                                                                                                                          1. 17

                                                                                                                            Someone did this manually on facebook: https://www.wired.com/2014/08/i-liked-everything-i-saw-on-facebook-for-two-days-heres-what-it-did-to-me/

                                                                                                                            They got sent down a fascist rabbit hole in no time. While poisoning Google’s database sounds desirable, I’d also rather not be classified as a fascist.

                                                                                                                            1. 3

                                                                                                                              that’s what happens on pretty much any platform. By default you get trapped in right-wing propaganda. Especially true for youtube

                                                                                                                              1. 0

                                                                                                                                It worries me how meaningless those historically heavy terms have become. Of course I’m being a bit sarcastic, but it’s diluted to the point of “fascist [fash-ist] noun, a person who has clicked a bunch of ads” and if in the year 2049 the government takes browsing history into account to judge a person, I will go to jail, because I installed Ad Nauseam 5 years ago and forgot to turn it off.

                                                                                                                                I’d also rather not be classified as a fascist.

                                                                                                                                I sometimes worry about this too. Like with 4chan and the OK-Hand sign, context gets so painfully lost. Lines become blurred and doing mallice with those blurred lines becomes easy. Be it the fault of algorithm, person or both, something should be done about this. I complain and offer no solutions, so I am a bit of a hypocrite.

                                                                                                                                As for Ad Nauseam, I think it’s really cool what was done here and being banned off Add-on stores really shows, that they successfully annoyed a good amount of people. Be it big Ad corpo or small artist’s blog being stripped of revenue, it created a good amount of discussion, that maybe this shouldn’t be the way the internet functions. Activism done damn right.

                                                                                                                                1. 5

                                                                                                                                  a person who has clicked a bunch of ads

                                                                                                                                  But that’s not a definition, that’s a mechanism for getting categorized by algorithmic advertising as a person interested in content promoting fascism.

                                                                                                                                  Like with 4chan and the OK-Hand sign, context gets so painfully lost.

                                                                                                                                  “The OK-Hand sign being a dogwhistle was actually a 4chan prank” is the same kind of useless factoid as “tomatoes are actually a fruit not a vegetable”. Yes, it’s true, but it is inconsequential trivia. 4chan may have initially tricked some “liberals” into believing the OK-Hand sign is a hate symbol at a time when no hate group was using it that way. But very early on actual white supremacists started actually using it as a dogwhistle – at first ironically I’m sure (because some white supremacists do hang out on 4chan) but soon it spread to very offline white supremacists who just copied it because it was a thing they saw other white supremacists do and get excited about.

                                                                                                                                  There’s a difference between a teenager saying their mom is a fascist for making them clean up their room and calling people like Stefan Molyneux or Richard Spencer a fascist for promoting extreme sexism, white supremacy and violent racial power fantasies. Yes, fascism is a somewhat vague term but most of the alternatives are too euphemistic or only get at certain aspects of how the ideology is presented rather than the ideological underpinnings. Umberto Eco’s shopping list isn’t an all-or-nothing deal either.

                                                                                                                                  So yeah, calling a conservative fascist because they are a bit homophobic is a bit of a stretch, but insisting that people like Stefan Molyneux are not fascists because they don’t tick off every item on the fascism checklist is pedantic at best and directly aiding fascism at worst. It’s not like fascism is a coherent ideology to begin with, it’s more of a way to con a people to go against its own interests and submit to a Great Leader under the pretense of restoring some supposed former glory and claim to greatness while actually creating asphyxiatingly oppressive power structures and eliminating undesirables.

                                                                                                                                1. 3

                                                                                                                                  Great write up! Explained the basic structure of Duff’s device so well, that I finally understand it. One big item on my todo list for years already is, I still cannot wrap my head around how the functionality of Duff’s device results in such beautiful structures like C coroutines, protothreads and C Async https://github.com/naasking/async.h

                                                                                                                                  I think I gotta program it myself to properly understand it…

                                                                                                                                  1. 3

                                                                                                                                    There’s a really nice piece on exactly that by the inimitable Simon Tatham, author of PuTTY (and much else).

                                                                                                                                    1. 2

                                                                                                                                      Many thanks for the reference, will read through.

                                                                                                                                    2. 2

                                                                                                                                      Yeah, coroutines is where I’ve encountered the Device before. (And actually implemented it once in a hairy experimental C++ implementation of async/await.)

                                                                                                                                      The way the Device works there is it lets you jump back into the middle of a function.

                                                                                                                                      • You wrap the whole function in a switch block.
                                                                                                                                      • When you need to “pause” it (i.e. call “await”/“yield”) you store a number representing what line you’re on, then return.
                                                                                                                                      • The following line is a switch case with that same number.
                                                                                                                                      • The function’s entry point fetches that saved line number and uses it as the argument for the switch … which takes it right to the line following your “await”.

                                                                                                                                      That’s the meat of it. The rest of the work is (a) wrapping that stuff up in some gnarly macros to make it look pretty, and (b) finding a place to save that line number, i.e. the coroutine’s context.

                                                                                                                                      The downside is that it’s difficult to use local variables in such a function because they get reset every time you yield. (IIRC I was able to get around this in my implementation by secretly wrapping the switch statement in a mutable lambda that captures the enclosing locals, turning them into saved state.)

                                                                                                                                      1. 1

                                                                                                                                        Thanks for taking the time to lay out the details. So this is the missing piece that was in my mind - the precrocessor is involved to incorporate line numbers. That’s super clever. Meta programming in C / C++ is on a whole other level of insanity and I love every drop of it.

                                                                                                                                    1. 3

                                                                                                                                      I also went a bit overboard. There is just some undeniable magic to soldering stuff to get a Quad-Core upgrade, replacing the CCFL with a LED in the x200 IPS panel to compete with daylight. Modding hardware mods. It’s way past rational, yet something special and I don’t even understand why.

                                                                                                                                      1. 2

                                                                                                                                        Ownership is special. Property is one of the greatest inventions of civilisation, while being one of the most maligned.

                                                                                                                                        In my opinion, the more you modify and customise something, the greater the sense of (and benefit from) ownership.

                                                                                                                                        I still remember the feeling of freedom when I realised I could drill a hole through a wall to run cables, without having to ask a landlord.