1. 7

    A GUI toolkit that is easy as html to use but as memory efficient as native.

    1. 5

      For some reason I’m reminded of XUL. And I think I just heard a Firefox developer cry out in terror.

      1. 2

        the big question there would be what features do you consider essential from html?

        1. 2

          This is an idea I’ve been toying with for some time. Basically an HTML rendering engine meant for GUIs, like Sciter. But instead of Javascript, you’d control everything using the host language (probably Rust). If you’d want JS you’d have to somehow bind that to Rust.

          I think this could really work out. However: I’ve dealt with XML and HTML parsers for years in the past, and I’m not sure I’m ready yet to dive into the mess that is HTML again.

        1. 6

          This sounds similar to how Pony does things

          1. 3

            Yup, though Pony takes it a bit further by introducing many different reference types/capabilities.

          1. 4

            I’ve had my fair share of both parser generators (even wrote one myself), consumption of those parsers (e.g. for a Ruby based XML/HTML parser), and hand-written recursive descent parsers (e.g. for Inko).

            I’ve grown to really prefer hand-written parsers. Parser generators are great if you have a reasonable and well established grammar and language to parse. However, you can hit walls quickly, and often there are no escape hatches. They also complicate your build process, which was a big issue for me in the past due to the use of Ragel for my lexers. I also really hate debugging parser generators, as the generated code is often a total mess.

            Parsing combinators are nice when you don’t want to separate lexing and parsing, you don’t want a separate build phase, and you can’t be bothered writing a recursive descent parser from scratch. For example, I used a Ruby parsing combinator to write a parser for a templating language GitLab uses for generating changelogs (parser here). Debugging parsing combinators can be a pain though, so I generally prefer hand-written parsers. I opted not to use one here to make it easier for others to maintain the parsing code.

            When evaluating what parsing approach to use, I would recommend the order: hand-written recursive descent > parsing combinator > parsing generator. Hand-written parsers just work much better in the long term, but parsing combinators can be easier to grok/maintain (if you don’t care about webscale performance). Parsing generators I would just avoid if you can.

            1. 1

              Even when I use a parser combinator approach which is often I still separate the lexing and parsing phases. I think it’s just a lot cleaner and easier to reason about. I personally don’t think there is a large amount of distance between parser combinators and hand rolled recursive descent parsing but everyone is a little different in their opinions on that I think. Either way I generally find most people I talk to end up gravitating to recursive descent and parser combinators being in their top two and parser generators getting used really only to prove out a grammar when you are playing with the syntax or when the grammer is already known available in a format the generator can already parse.

            1. 5

              A similar (but smaller) list is found here. Mind you these are only languages active on the /r/ProgrammingLanguages subreddit IIRC.

              1. 3

                For the last few months I’ve been hard at work to change the memory model/type system of Inko from the usual (garbage collection and no clear ownership) to a single ownership model (based on this paper).

                For the last two weeks I’ve been working on the allocator, and specifically the strategy for reclaming memory. So far I have an idea that I’m in the process of writing tests for. However, I need to give this some more thought, as I’m not entirely sold on my idea just yet.

                1. 3

                  The second co-author of the paper is David F. Bacon. I can’t recommend this highly enough for anyone who is interested in reading memory management: read everything that he has ever written.

                1. 2

                  Always nice to see more people build programming languages. I will say this: be prepared to change a lot of your assumptions, implementation, etc 1-2 years from now. As you start working on the language you’ll likely find certain ideas won’t work anymore, or you realise you just prefer to replace one particular feature with something else :)

                  1. 1

                    That’s partially why I wanted to write the goals upfront and not include many specifics in this post. The language syntax and semantics will evolve as I build things out, but the goals should be relatively static.

                  1. 11

                    I find these kind of articles exhausting. They usually come down to the same: pattern X seen in paradigm Y is bad, therefor Y is bad. The alternatives proposed usually aren’t really good either. Basically once you’ve read one of these, you’ve read all of them.

                    For example:

                    If it looks like a candidate for a class, it goes into a class. Do I have a Customer? It goes into class Customer. Do I have a rendering context? It goes into class RenderingContext.

                    Then the “solution” presented in this article:

                    The data itself will be in form of an ADT/PoD structures, and any references between the data records will be of a form of an ID (number, uuid, or a deterministic hash). Under the hood, it typically closely resembles or actually is backed by a relational database: Vectors or HashMaps storing bulk of the data by Index or ID, some other ones for “indices” that are required for fast lookup and so on.

                    Now there’s nothing wrong with plain old data structures. But eventually those data structures are going to need a bunch of associated functions. And then you pretty much have a class. In other words, the solution is basically the same as the problem.

                    The real problem isn’t unique to OOP and can just as easily occur in say functional programming languages. That is, the problem is people over-applying patterns without thinking “Hey, do we actually need this?”. Traditional OOP languages may promote this in some way, but again that’s a problem with those languages. The concept of OOP has nothing to do with any of this.

                    Random example: in any language that has support for macros, inevitably some will start abusing macros. But that doesn’t mean the entire language or its paradigm is bad and should be avoided.

                    As an aside, every time I see a quote from Dijkstra I can’t help but feel this man must have been absolutely insufferable to work with. Yes, he was very smart and made many contributions. But holy moly, his “I am right and everybody else is wrong” attitude (at least that’s how it comes across to me) is off putting to say the least.

                    1. 5

                      Now there’s nothing wrong with plain old data structures. But eventually those data structures are going to need a bunch of associated functions. And then you pretty much have a class. In other words, the solution is basically the same as the problem.

                      It is the other way around. With OOP, you pretty much end up jamming into data structure definitions what essentially are functions. The concept of class is fuzzy and it’s not a clear well define starting point for a thought process.

                      Notice that you said “associated functions”. I think it’s all the OOP non sense cornering you into that unclear language. What exactly are those? Functions that accept the type you are defining? Functions that manipulate the state of said data structure? Functions that return a reference to it?

                      If you think about this questions and find clear answers for them, you will realize that there is absolutely no reason to make functions have all sorts of tricky behaviours based on state or even “belonging to an instance”. At which point the concept of class becomes pointless.

                      Relational algebra was developed with solid theory behind it. To my knowledge, OOP was just something thrown together “because it is a good idea”.

                      Records, as in compound types, are very useful in many fields even outside programming languages. Hooking functions to them is just a strange idea whose motivation I am yet to discover.

                      1. 2

                        Notice that you said “associated functions”. I think it’s all the OOP non sense cornering you into that unclear language. What exactly are those?

                        When I say “associated function” I mean that in the most basic sense: it simply does something with the data, regardless of how the code is organised, named, etc.

                        If you think about this questions and find clear answers for them, you will realize that there is absolutely no reason to make functions have all sorts of tricky behaviours based on state or even “belonging to an instance”. At which point the concept of class becomes pointless.

                        I’m not sure what tricky behaviour have to do with anything. That just seems like you’re inventing problems to justify your arguments.

                        even “belonging to an instance”

                        Perhaps this comes as a surprise, but this exists in functional programming too. For example, if you have a String module with a to_lowercase() function, and that function only operates on strings, then that function basically “belongs to an instance”. How exactly you store that function (in the instance, elsewhere, etc) doesn’t matter; the concept is the same. Whether the data is mutable is also completely unrelated to that, as you can have OOP in a completely immutable language.

                        Relational algebra was developed with solid theory behind it. To my knowledge, OOP was just something thrown together “because it is a good idea”.

                        I suggest you do some actual research into the origins of OOP, instead of spewing nonsense like this. It’s frankly embarrassing.

                      2. 4

                        Have you ever stumbled upon good OOP code that actually looked OOP?

                        I haven’t. The good code I’ve seen was inevitably a mix of procedural, modular, and functional code, with a heavy slant towards either procedural or functional, with maybe a couple instances of inheritance, for polymorphism’s sake (and even then, sometimes we just pass functions directly).

                        The most distinguishing characteristic I see in OOP is how it stole almost every features to other paradigms or languages. ADT, encapsulation? Modular programming, from Modula. Generics? Parametric polymorphism from ML and Miranda. Lambdas? From every functional language ever. The only things left are inheritance, which was added in Simula to implement intrusive lists (which were needed because there was no C++ like templates), and subtype polymorphism, which is often better replaced by good old closures.

                        And guess what, inheritance is now mostly discouraged (we prefer composition). The only thing left is subtype polymorphism. OOP is an empty husk, that only survives by rebranding other programming styles.

                        1. 2

                          ADT, encapsulation? Modular programming, from Modula.

                          ADTs come from Barbara Liskov’s CLU, which cites Simula’s inheritance as inspiration.

                          1. 1

                            Hmm, didn’t know, thanks. I looked Modula up as well, it seems both languages appeared at rather the same time.

                          2. 1

                            Have you ever stumbled upon good OOP code that actually looked OOP?

                            This depends on what one would consider OOP, as the opinions/interpretations differ. Have I seen good OOP? Yes. Was that Java-like OOP as I would imagine most people think OOP is like? No. But just because something is OOP doesn’t mean it can’t have elements from other paradigms.

                            The most distinguishing characteristic I see in OOP is how it stole almost every features to other paradigms or languages. ADT, encapsulation? Modular programming, from Modula. Generics? Parametric polymorphism from ML and Miranda. Lambdas? From every functional language ever

                            Ah yes: functional languages invented everything, and every other language using elements from this is “stealing” them.

                            I’m honestly not sure what point you’re trying to make. X sharing elements with Y doesn’t mean somehow X isn’t, well, X. Just as how X having flaw Y doesn’t completely invalidate X. Having such a single minded (if that’s the right term) attitude isn’t productive.

                            1. 3

                              Ah yes: functional languages invented everything, and every other language using elements from this is “stealing” them.

                              Not just functional. Modules did not come from functional languages, that I recall.

                              To some extent though, yes: functional languages invented a lot. Especially the statically typed ones, whose inventors realise this fundamental truth that often gets me downvoted in programming forums if I voice it: that programming is applied mathematics, and by treating it as such we can find neat ways to make programs better (shorter, clearer, or even faster). Dijkstra was right. Even Alan Kay recognises now through his STEPS project that “math wins”. (Of course, it’s very different from calculus, or most of what you were taught in high school. If anything, it’s even more rigorous and demanding, because at the end of the day, a program has to run on a dumb formal engine: the computer.)

                              I’m honestly not sure what point you’re trying to make.

                              That to many OOP proponents, “OOP” mostly means “good”, and as we learn how to program better over the decades, they shift the definition of “OOP” to match what they think is good. It takes a serious break, like data oriented programming, to realise that there are other ways. To give but an example: back in 2007, I designed some over-complicated program in C++, with lots of stuff from the <algorithm> header so I could pretend I was using OCaml (I was an FP weenie at the time). My supervisor look at the code (or maybe I was outlying my design to them, I don’t remember), and said “well, this is very OO and all, but maybe it’s a bit over-complicated?”

                              That’s how pervasive OOP is. Show a programmer functional patterns (with freaking folds!), they will see OOP.

                              OOP is no longer a paradigm. It devolved into a brand.

                          3. 2

                            But eventually those data structures are going to need a bunch of associated functions. And then you pretty much have a class.

                            Running in the risk of taking your quote out of context, I think the mindset OOP is simply data structures with encapsulated functions is actually one of the biggest real dangers of OOP, because it hides its biggest flaw: pervasive proliferation of (global) states.

                            Thus, I understand where you are leading your argument, but I disagree with it.

                            As an aside, every time I see a quote from Dijkstra I can’t help but feel this man must have been absolutely insufferable to work with. Yes, he was very smart and made many contributions. But holy moly, his “I am right and everybody else is wrong” attitude (at least that’s how it comes across to me) is off putting to say the least.

                            I happen to know a lot of people who directly worked (or had classes) with him, and unanimously I hear both adjectives: genius and pretentious.

                            Of course those are just others’ opinions, not mine, but I share your (and those people) feelings.

                            1. 1

                              Running in the risk of taking your quote out of context, I think the mindset OOP is simply data structures with encapsulated functions is actually one of the biggest real dangers of OOP, because it hides its biggest flaw: pervasive proliferation of (global) states.

                              I agree a lot of OOP languages/projects suffer from too much (global) mutable state. But I’m not sure if that’s necessarily due to OOP. I think this is a case of “correlation is not causation”. Perhaps a silly example: if functional languages had mutable state, I think they would have similar issues. In other words, I think the issue is mutability being “attractive”/tempting, not so much the code organisation paradigm.

                              Another example: I think if you take away the ability to assign non-constant types (basically anything but an int, float, string, etc) to constants/globals, and maybe remove inheritance, you already solve a lot of the common issues seen in OOP projects. This is basically what I’m doing with Inko (among other things, such as replacing the GC with single ownership).

                              I do think for such languages we need a better term for the paradigm. Calling it X when it mixes properties from A, B, and C is confusing. Unfortunately, I haven’t found a good alternative term.

                            2. 2

                              I view OOP as an organizing principle—when you have few types, but lots of actions, then procedural is probably the way to organize the program (send the data to the action). When you have a few actions, but lots of types, then OOP is the way to organize the program (send the action to the data). When you have few actions, few types, then it doesn’t matter. It’s that last quadrant, lots of types, lots of actions, there is currently no good method to handle.

                              1. 2

                                When you have X types and Y actions, unless you have many of both, I believe your program is already mostly organised. Many types and few actions? It will end up looking OOP even if you write it in C. Few types and many actions? It will end up looking procedural even if you write it in Java.

                            1. 38

                              One tidbit I found interesting in the April 2021 update is this (paraphrased for brevity)

                              After only three weeks of having a Discord server, we have over 1,400 members, ten times as many as we’ve ever had in the IRC channel. This led to a ton of new development projects.

                              I think this says a lot about IRC, the ease of use of Discord, and disproves the notion that eager contributors are willing to overcome any friction necessary to participate in a given community. While I’m hopeful that Matrix will eventually supplant Discord as the chat-platform-of-choice for open source software projects, it’s still nice to hear that SerenityOS was able to pull in more interested folks by using Discord.

                              1. 11

                                I’m just very very glad people aren’t using Slack. Discord is at least made by people who understand the idea that harassment exists and therefore haven’t deliberately left out table-stakes features like letting one individual block messages from another.

                                1. 4

                                  Slack assumes it’s an HR issue and that if you’re working with someone who’s harassing you, you have bigger problems (and solutions) to the issue.

                                  1. 12

                                    That’s their excuse, and it’s shit.

                                    Aside from that, it’s wildly inappropriate for places where you don’t have HR, such as communities with open admission.

                                    1. 6

                                      That’s not what slack is for. Don’t use slack for that.

                                      1. 6

                                        Yeah, I agree, just relaying the excuse. Slack outside of closed-room workspaces feels awkward to me.

                                  2. 4

                                    I think one issue with Matrix is the lack of a good, stable and accessible client. Element is probably the easiest to start with, and it’s still confusing to use. Discord at least nailed that: it’s easy to invite people, group related channels, etc.

                                  1. 53

                                    Here’s two things I noticed about this benchmark:

                                    1. A minor issue, but the Go program has a data race. The i loop variable is captured in the spawned goroutines while it is mutated by the outer loop. Fixing it doesn’t change the results of the program. It’s also immediately caught when built with the -race flag. Rust being data race free by construction is a super power.

                                    2. Changing the amount of spawned goroutines/threads to 50,000 has a noticeable difference between the two on my machine. The Go program still completes in a timely fashion with ~5x the rss and no negative impacts on the rest of my system:

                                    real 11.25s
                                    user 41.49s
                                    sys  0.70s
                                    rss  135136k
                                    

                                    but the Rust version immediately causes my system to come to a crawl. UIs stop responding, audio starts stuttering, and eventually it crashes:

                                    thread 'main' panicked at 'failed to spawn thread: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', src/libcore/result.rs:1189:5
                                    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
                                    Command exited with non-zero status 101
                                    real 16.39s
                                    user 23.76s
                                    sys  98.50s
                                    rss  288132k
                                    

                                    So while it may not be significantly lighter than threads as far as this one measure is concerned, there is definitely some resource that threads are taking up that goroutines are not. I checked on some production monitoring systems to see how many active goroutines they had, and they were sitting comfortably in the 20-30k area. I wonder if they were using threads how they would fare.

                                    1. 8

                                      Rust being data race free by construction is a super power.

                                      Well, it also necessarily prohibits entire classes of useful and productive patterns… it was a design decision, with pros and cons, but certainly not strictly better.

                                      1. 4

                                        Strong plus +1. I wish, for application development, it was possible to remove lifetimes, borrow-checker and manual memory management (which are not that useful for this domain) and to keep only fearless concurrency (which is useful even (more so?) in high-level languages). Alas, it seems that Rust’s thread-safety banana is tightly attached to the rest of the jungle.

                                        1. 7

                                          FWIW. Ponylang has exactly this:

                                          • no lifetimes, data is either known statically via simple escape analysis or traced at runtime
                                          • no borrow checker, although it does have a stricter reference capability system
                                          • no manual memory management: uses a deterministically invoked (excluding shared, send data) Mark-and-no-sweep GC
                                          • has the equivalent Send and Sync traits in its reference capability system which provide the same static guarantees

                                          As with everything though it has its own trade offs; Whether that be in its ref-cap system, lack of explicit control in the system, etc.

                                      2. 4

                                        To prevent that Rust error, I believe you need to change vm.max_map_count: https://github.com/rust-lang/rust/issues/78497#issuecomment-730055721

                                        1. 4

                                          That seems to me like the kind of thing Rust should do to some extent on its own!

                                        2. 3

                                          I’d be interested to see how many threads ended up scheduled with the Go example. My guess is not many al all: IIRC the compiler recognizes those sleeps as a safe place to yield control from the goroutines. So I suspect you end up packing them densely on to threads.

                                        1. 2

                                          I use a Gergoplex. I’ve gone through various keyboards over the years, but this is an entirely different level. The switches are super sensitive compared to MX Browns, which definitely takes some getting used to, but it’s less tiring on the fingers.

                                          1. 2

                                            I have been using IRC via Matrix.org and element.io client. Works well.

                                            https://element.io/

                                            https://matrix.org/

                                            1. 1

                                              One thing I always wondered: when logging in through nickserv, does Element/Matrix store your IRC credentials in plain text?

                                              1. 1

                                                I can’t see how they would avoid this.

                                              2. 1

                                                Likewise

                                              1. 1

                                                I use systemd unit files for a custom break reminder program. It works quite well (better than existing software for me), though sometimes it fails to start the screensaver after waking up; haven’t seen that happen recently though.

                                                1. 1

                                                  I didn’t even realize ExecStart could take formatting (your %h), nice. Thanks for sharing

                                                1. 17

                                                  Paul Graham knows he’s smarter than most people (that’s not hard, most of us in here are, statistically), and he still thinks this fact makes him right all the time. He’s rich and has a big audience, so this is unlikely to change.

                                                  Not sure why this post needs to exist, but definitely can’t see why it needs to be here.

                                                  1. 9

                                                    PG reminds me of a pattern I’ve seen in other people. That is, a person experienced in one particular area develops the idea they are experienced in many other areas. They then proceed to share their wisdom of these areas, when in reality they know jack shit. The way these people write or speak can make it difficult to distil bullshit from facts.

                                                    When encountering such people, especially if they develop a cult following like PG, I think it’s entirely reasonable to call such people out. The article posted may beat around the bush a bit too much, but it provides many good examples. As such, I think it’s existence is entirely valid.

                                                    1. 5

                                                      Engineer’s disease? The amusing part to me, is that it reminds me of that trope in movies “oh, you’re a scientist? clearly you’re a polymath” - except it’s real.

                                                      1. 1

                                                        Yeah, I agree - when i was younger and finding my footing in tech i was quite taken with PG (and i certainly do feel like spending some time learning lisp has made the functional programming paradigm more intuitive to me) but it has been valuable to me to see critiques of his work as well, especially in trying to apply the things he actually was expert at to unrelated fields. He certainly was personally successful - more so than most people criticizing him, I’m sure (but things aren’t necessarily fair), but it can be helpful to point out that at some point he just stopped being very relevant.

                                                        …but I personallly still don’t like java, and prefer lispy FP to heavy handed OOP.

                                                      2. 4

                                                        because for sure in this audience there are people that would take his expertise in programming as a source of authority on other topics (pretty much like most people do with celebrities advocating for a cause) and maybe it’s useful to remind them, with terms they can understand, that this is magical thinking a few rich people use to steer the whole sector.

                                                        1. 3

                                                          They will not rest until they cancel https://timecube.2enp.com/

                                                        1. 1

                                                          I use a customised version of Colemak-DH. I just use the regular Vim keys. The K being above the J took some getting used to, but nowadays I don’t really think about it. I thought about rebinding them, but then I probably have to rebind a bunch of other keys as well.

                                                          1. 2

                                                            @cadey I’ve been considering a moonlander for a bit, and I’m curious about how well it would work for me. I use a Kenisis Advantage now, but want something split for the gaming features, portability, nice lights, programmability, etc.

                                                            1. What were the keyboards you used before this? Were they “ergo” or more typical kinds of things?

                                                            2. This can be a bit private, but would you be comfortable sharing your hand or finger length? My fingers are on the stubby side so the cups on the kenisis help with that aspect of “reaching” for keys

                                                            3. What key layout do you use? QWERTY/dvorak/?

                                                            1. 3

                                                              Advantage has better tenting than the Dox or Moonlander. The Lander looks to utilize a similar thumb cluster to the Dox, which has serious issues unless you tent to an extreme amount (55-70°) but the way the Lander is designed, your limited to the amount of tent via the thumb cluster alone. I use an Advantage in tandem with some other splits like the Iris and enjoy them a lot more. You can also QMK your Advantage via the KinT controller (https://github.com/kinx-project/kint), they’re easy and really open up the possibilities. I’m highly opinionated about ergo setups, but my philosophy is that if the board is flat, tent it as high as it’ll go, the neutral position of the wrist is 70°. There’s also the Dactyl and Manuform variations if you’re curious about a more split contoured situation, which are very nice to type on as well. As with everything said, ergonomics is highly personal and what works for certain individuals can be detrimental to others, so experiment and enjoy spending too much money in the pursuit of pain free programming.

                                                              1. 5

                                                                As with everything said, ergonomics is highly personal and what works for certain individuals can be detrimental to others, so experiment and enjoy spending too much money in the pursuit of pain free programming.

                                                                This is worth highlighting. I have an Ergodox and experimented extensively with tenting and tilting. I found that any tent angle pushes my hands upwards a bit relative to my forearm; causing pain in my arm muscles (the one that connects to your pinky and ring finger, forgot the name) after prolonged use.

                                                                I ended up putting my Ergodox flat on the desk, which has thus far been much more comfortable. For me wrist pain has never been an issue either, instead it has always been either shoulder pain or forearm pain. Tenting doesn’t really help against either from what I’ve experienced, instead it comes more down to the correct desk/chair/etc height, and overall posture.

                                                                1. 2

                                                                  I found that any tent angle pushes my hands upwards a bit relative to my forearm; causing pain in my arm muscles (the one that connects to your pinky and ring finger, forgot the name) after prolonged use.

                                                                  This is correct, if you tent heavily, you need a keyboard tray or mechanism to lower the mounted surface, like a tripod on the floor so that the two half’s come up to the waist or a sit stand desk, where you can lower the table where your forearms are at an optimal angle. I tent with primarily 60% and lower boards, so I have my table almost sitting on my legs as I type and when I use my Advantage, I use it on my lap with a trackball in the center.

                                                              2. 2
                                                                1. DasKeyboard Ultimate, Logitech MX keys, Logitech G810, Apple butterfly
                                                                2. my middle finger is 5u long almost exactly
                                                                3. colemak
                                                                1. 2

                                                                  does it confuse people that your keys are labeled qwerty but actually colemak?

                                                                  1. 4

                                                                    My fiance’s reactions are priceless. My favorite in recent memory is “your layout is fucking crazy”.

                                                              1. 2

                                                                Here’s mine. As the years went by I kept making it more and more simpler, and faster. I think I can get it a little bit faster by getting rid of the web font, but system fonts are a bit too inconsistent for my liking.

                                                                1. 1

                                                                  Enjoy everything minimal, so I like the design. But style-wise - not sure I like the decision to make inline code elements bold.

                                                                  1. 1

                                                                    It’s something I’m still on the fence about as well, so I might change it to something a little less present.

                                                                1. 19

                                                                  I just want to point out that planting trees is the worst kind of CO2 compensation.

                                                                  • Young trees don’t absorb as much CO2 as old ones
                                                                  • Planting trees does not actually change the fact that we are emitting too much CO2.
                                                                  • There are not a general solution in the sense that everyone could just compensate with trees and everything is fine

                                                                  It is better to compensate via an investment in green and sustainable projects

                                                                  1. 32

                                                                    I just want to point out that planting trees is the worst kind of CO2 compensation.

                                                                    The benefits of the tree are for tomorrow not today and aren’t purely for CO2 sequestration. You also reduce/mitigate things like desertification, help change local climate, provide future nesting area for birds etc…

                                                                    Don’t let a good thing like planting trees stop you from doing so because it alone won’t fix CO2. We need multi pronged approaches. And given how many trees are dying now due to fires, I can’t get behind not trying to plant more to fix the after effects of us not dealing with CO2 in the atmosphere.

                                                                    1. 10

                                                                      I disagree. While planting a few trees won’t have an immediate effect, it has a few nice properties:

                                                                      1. It’s easy: provided you have a sapling and a shovel you can do it. Or even easier, donate to something like Trees for all and have somebody else do it at a much larger scale.
                                                                      2. We can do it today
                                                                      3. It benefits nature as a whole, e.g. by providing nesting space for birds
                                                                      4. It’s probably the least prone to corruption, misuse of funds, or some other form of “damage” to others.
                                                                      5. Provided they are taken care for (or just left alone), a forest can last for more or less forever (at least here in The Netherlands where we don’t have massive wildfires and what not). I think wind turbines only last 2-3 decades or so.

                                                                      Of course there are far more effective ways, such as banning cars and massive investments in public transportation. But these methods tend to be very political, take years to complete, usually are horribly expensive, and may be prone to misuse.

                                                                      A random recent example: a wind park was built in The Netherlands, with enough energy to provide 300k-something homes with electricity. The Dutch government invested something like €600 million, with the promise that locals would get (IIRC) a discount. This would be a huge benefit for the environment, as a few birds flying into a wind turbine is worth saving tons of CO2.

                                                                      Except it all went to a (newly built) data centre from Microsoft. All of it. This in spite of The Netherlands lagging behind massively when it comes to adopting renewable energy sources.

                                                                      For reference, that €600 million would’ve been enough for roughly 96 000 trees according to the Trees for All website. The exact amount of CO2 this can store is hard to calculate. A statistic I found on a few websites is roughly 20KG of CO2 per tree per year. At 96 000 trees that would translate to 1 920 000 KG (2 116 tons) of CO2 per year.

                                                                      Of course it would’ve been even better to just give the wind park to citizens as originally intended, but this is just an example to show that planting trees can be very effective.

                                                                      1. 2

                                                                        Provided they are taken care for (or just left alone), a forest can last for more or less forever (at least here in The Netherlands where we don’t have massive wildfires and what not). I think wind turbines only last 2-3 decades or so.

                                                                        Not only in the netherlands, but pretty much everywhere. While still natural events, most present days wildfires, or at least their scale, are very much a result of replacing naturally occurring forest with vast areas of monoculture of trees for wood production purposes. Covering thousands of acres with pines, spruces and eucalyptus in places like south europe, south africa or california is essentially turning land into a gigantic fuse. Before man-made forests, such trees had to share the space with leafy trees such as oak, chestnut, acer, birch, cherry, etc. These are not only less flammable themselves, they also provide thicker shadow, retaining more humidity and allow for less flammable smaller plants to grow below their canopy.

                                                                        You also forgot a very important plus for trees: their impact on human life quality. Few things are more therapeutic than taking a walk on a quite forest. And even in the city or indoors, humans naturally need proximity with nature.

                                                                      2. 9

                                                                        But it doesn’t hurt, right? If we would plant as much as we cut, we’d still help a lot – or this wouldn’t hold?

                                                                        1. 5

                                                                          Yes, a small amount. See https://savingnature.com/offset-your-carbon-footprint-carbon-calculator/, then multiply the results by a few billion people per year.

                                                                        2. 2

                                                                          Not only that, but most of these “we plant trees for you” operations are planting tree farms that would have been planted anyways. They’re also monocultures that don’t support ecosystems the way a real forest would, but I think people get this image of a proper forest when they hear about these things—and it ain’t so.

                                                                          1. 2

                                                                            It’s not the best but it’s certainly not the worst. It ranks higher in CO2 reduction than buying a carbon offset for example.

                                                                            What most companies don’t realise is that it’s not enough to be carbon neutral, they need to be carbon negative and actively reduce the level of CO2 rather than maintain it. The heating effects of elevated CO2 are cumulative.

                                                                            1. 2

                                                                              Thanks I didn’t know this.

                                                                              1. 15

                                                                                Edit: this is in reply to GP.

                                                                                Obviously, the need to plant trees arises from the fact that we have destroyed huge areas of forest and woodland already and should try to re-establish the balance of co2 absorption.

                                                                                Literally every single old tree has been a young tree once. You need to plant trees and let them grow old. By your logic there could never be any benifit of planting a tree, carbon wise. You don’t need to cut down an old tree to plant a new one. An old tree plus a young tree abdorve more co2 than the old one alone. I am not sure what you are trying to point out with your first bullet point.

                                                                                Although I absolutely agree with your second and third point. And that applies to most modern “solutions”. There is this idea that we just switch do PV panels, or electric cars or plant a bunch of trees and everything is fine. While the problem is much more deep rooted in the very concept of our current modern society.

                                                                                1. 5

                                                                                  I totally agree, but the conservation and planting of trees and the compensation of everyone‘s CO2 emissions are two different problems in my opinion. I cant just hit a stranger in the face and pay the medical bills.

                                                                                  1. 4

                                                                                    Yes, I think it’s clear that both these problems should be worked on. Too much CO2, and too little trees.

                                                                              2. 1

                                                                                We have too many trees here. You can adopt some of them

                                                                              1. 1

                                                                                Why would you represent lists as hash-maps? I’m getting PHP flashbacks 😱

                                                                                1. 3

                                                                                  What’s the problem?

                                                                                  1. 2

                                                                                    Some drawbacks of using hash maps versus actual arrays:

                                                                                    • Lookups are slower, and likely not constant time (IIRC it’s usually more like O(log n))
                                                                                    • They need more memory
                                                                                    • Less cache-friendly
                                                                                    • Iterating them is less efficient compared to an array, as memory is not in a contiguous order. In my own experiments I found that iterating a Rust hash map is about 50 times slower compared to iterating a vector
                                                                                    • Insertions are slower if there are collisions
                                                                                    1. 3

                                                                                      The implementation of the language can decide to use arrays if it notices that your keys are a contiguous set of integers starting from some small integer. This is what Lua does for example. So that removes all of the implementation-dependent disadvantages you are talking about.

                                                                                      On the other hand, on the interface / usage side, it does make it so if you eg. want to remove an element and shift all the others down, you need to explicitly say that you want array / list behavior vs. map behavior.

                                                                                      1. 4

                                                                                        Yeah, I remember from reading one of the Lua papers that the runtime does a bunch of clever things to optimize for tables being used as arrays. What I didn’t get was why this is better than simply having actual arrays in the language, and removing the need for the clever runtime code.

                                                                                1. 40

                                                                                  Rust is hard because it draws heavily from two of the hardest other languages to learn: C++ and Haskell. If that’s not enough, it dumps the borrow checker (not too bad if you’re from C++) and then lifetimes on you.

                                                                                  C++

                                                                                  • const/non-const versions of functions (&self, &mut self)
                                                                                  • compile-time directives (#[cfg, etc.)
                                                                                  • references vs values
                                                                                  • moving and copying
                                                                                  • operator overloading
                                                                                  • RAII (c’tors, d’tors)
                                                                                  • monomorphism

                                                                                  Haskell:

                                                                                  • pattern matching
                                                                                  • derive as in “typeclass”, not as in OOP
                                                                                  • traits are like typeclasses, not interfaces in OOP
                                                                                  • enum as sum types
                                                                                  • inferred typing
                                                                                  • using types to indicate usage

                                                                                  In isolation this is a lot of strange things. I’m an experience C++ dev, so those points weren’t difficult and I was able to get productive in Rust rather quickly. However, it wasn’t until I spent the last month or so learning Haskell that a whole bunch of the parts I thought were quirky started to make considerably more amounts of sense.

                                                                                  1. 15

                                                                                    I think this is spot on, and is very similar to my experience (except I knew Haskell before Rust). The reality is Rust is simply not a beginners language, and I don’t think it will ever be one.

                                                                                    In terms of complexity, I do think Rust is up there with Haskell and C++, but I can’t help but think C++ and Haskell have quite a bit of accidental complexity due to legacy reasons. Rust certainly has a bit of that, but overall the language is extremely well designed and I almost think that makes it more daunting. You can’t just point to some complexity and say “oh thats just for some silly X, Y and Z,” its always “Oh, that has some real and important purpose X, Y and Z.”

                                                                                    Rust will certainly get there in terms of accidental complexity (its a very young language, that cruft is built over time), and I can only imagine how complicated it might become one day. The async/await has some of this – because even though I think it is well designed (for now) it is exceedingly complicated, and I have a hard time believing that nothing better will come about (leaving cruft).

                                                                                    1. 4

                                                                                      async/await .. think it is well designed

                                                                                      I already know people calling it poorly designed today, with statements like “optimized for ~no CPU work on the critical path”.

                                                                                      1. 3

                                                                                        At a minimum, it’s fairly awkward to use when you have a mixed I/O and CPU bound workload. The project I’m working on like that splits work between Tokio and Rayon for that reason. All of the client libraries we’re using are based on async, so it would be challenging to choose a different style of concurrency.

                                                                                        1. 2

                                                                                          Wouldn’t that be the executors that are poorly designed? The actual built-in async/await support doesn’t seem specific to any given workload.

                                                                                          1. 2

                                                                                            I think the issue with async/await is not so much the implementation in Rust, but all the different (incompatible) libraries built on top of it. This means that importing a few dependencies can lead to a few different async/await runtimes being used, with all the trouble that may bring.

                                                                                        2. 7

                                                                                          I think it the listed features are more from ML than Haskell. Even the first compiler of Rust written in OCaml. https://github.com/rust-lang/rust/commit/6997adf76342b7a6fe03c4bc370ce5fc5082a869

                                                                                          1. 6

                                                                                            I feel like some of these things took no time at all to learn, such as pattern matching and enums as sum types. It was more of a “well fucking finally” than a “how does this work?”

                                                                                            1. 4

                                                                                              I think the sort of challenge comes at identifying usage of these when you spend your life not using sum types (and instead relying on stuff like OOP to get the effects). Also, pattern matching does affect thigns like the flow of ownership, so you can land on some non-intuitive stuff. I “get” this stuff but ended up losing a good amount of time in a refactor because of pattern matching + implicit reference stuff.

                                                                                              Rust isn’t Haskell, but it does have the “if you want to avoid problems, write code in a very specific way” quality to it that makes “porting this C code to Rust” non-obvious at times.

                                                                                              1. 1

                                                                                                I first encountered some of this when I poked at OCaml in college, after really only knowing Javascript, Java, and a bit of Scheme. It was immediately obvious to me how much better pattern matching was than the equivalent if-statements.

                                                                                                On the other hand, I’m also kind of a paranoid coder overall, and was already dissatisfied with how verbose and risky if-statements were, so I suppose I already had a use-case in mind before I saw the feature.

                                                                                            2. 2

                                                                                              Coming from a C++ background, it’s generics and especially lifetimes that give me a hard time.

                                                                                              Generics are superficially like templates, but their type-checking is much stronger. Templates kind of let you sneak away from strong typing, kind of like structured macros. Generics don’t. I’m sort of used to this because I’ve used Swift (and a bit of Scala) but sometimes I find it hard to convey to the compiler exactly what the type constraints on T need to be.

                                                                                              Lifetimes are something I understand and manage all the time, both manually and by rigging up C++ stuff to enforce them for me with RAII. What I’m not used to is having to explain my logic to the compiler, especially when there are only limited facilities for doing so and the syntax is kind of arcane. This is where I tend to rage-quit and why I haven’t gotten farther.

                                                                                              This may also explain why I’m liking Nim more: it’s kind of Rust-like but comfier. Its generics hew closer to Rust than C++, but it also has things closer to C++ templates (cleverly called “templates”). And its GC/refcounting means I don’t have to sweat lifetimes so much; that comes at a cost, of course, but as I’m not writing device drivers or lightbulb firmware I don’t mind.

                                                                                            1. 32

                                                                                              This article seems to make some wrong assumptions, like so many RSI/ergonomics articles. I’ll cover some of them below. RSI/ergonomics articles usually frustrate me greatly, so apologies in advance for the wall of text.

                                                                                              Tilting wrists up is bad - the normal up-sloping keyboard is bad. It should be exactly the opposite:

                                                                                              Negative tilt as it’s called is often not an option when sitting, as it requires either a very flat keyboard or a desk that is very low. When standing you have more flexibility in this regard, but it depends on the height of the keyboard.

                                                                                              Long key travel (sideways) is bad therefore QWERTY is bad.

                                                                                              IIRC there is no hard evidence for this. There are a bunch of websites out there that measure the “quality” of the layout, but this usually comes down to “more moving around = bad”. From my own experience, that’s far too short-sighted. For example, the way you bend fingers and which ones you use impacts the stress on the muscles.

                                                                                              Multiple pressure at the same time is bad, therefore Ctrl+C/S/V with one hand is bad.

                                                                                              Pressing up to two keys at a time should be fine, provided all keys are within reach. Especially if you move Control somewhere on the home row (e.g. where caps lock usually is), then Ctrl+V/etc are fine.

                                                                                              Exercise helps sometimes - pushups, pullups, dips, and situps. Not too much, though. Sleep too. But it doesn’t always fix RSI.

                                                                                              Pushups don’t do shit about RSI, as IIRC you use different muscle groups. Also be very careful with exercise in general, as putting more stress on already overworked muscles can do some real damage. Situps also don’t do anything, and can actually hurt your spine if done on a surface not soft enough.

                                                                                              If you have determined your muscles are ready for exercise (e.g. you have given them enough rest), try deadlifts and squats. Squats help with circulation, deadlifts I found to really help strengthen your arm/wrist muscles.

                                                                                              It is never “cured”, just managed. Know what triggers your RSI.

                                                                                              RSI is a result of poor posture/etc, and a result you can cure. RSI isn’t some weird trait you inherit and can’t get rid of. It just may take a long time.

                                                                                              Have multiple keyboards, switch every 10 minutes (seriously!) or twice a year

                                                                                              No idea what benefits this would bring. In fact, I suspect it will just be frustrating as you have to relearn key positions/etc every time. Just get one good keyboard that you can remap.

                                                                                              Comfortbead Wrist Rest

                                                                                              Avoid wrist rests like the plague. Palm rests have their uses, but they are rarely the exact right height. Just learn to hover type instead.

                                                                                              Take breaks every 10-45mins - apparently you can use Workrave (or AntiRSI for Mac or other software) to enforce breaks.

                                                                                              Anything above 20 minutes is too much. I currently use a break schedule of a 30 seconds break every 20 minutes, and 5 minutes every 60 seconds. IIRC there are some parts of your body that just start entering sleep mode after about 20 minutes of sitting, and standing up really helps with that.

                                                                                              The rest of the article just appears to be a list of resources found elsewhere, without any real insight. So I will give my own advice, which hopefully is a bit more useful. As a background, I have been programming professionally for about 10 years:

                                                                                              • Bookmark http://www.triggerpoints.net/ and use it to massage the right muscles when they hurt. Get a lacrosse ball or similar to help with this. This is especially useful when massaging your back: place the ball on your back and against a wall, then massage your muscles like a bear scratching its back against a tree.
                                                                                                • Basically just as we have collections of libraries to use when writing code, you should build a collection of tools/techniques to help take care of yourself
                                                                                              • Take breaks every 20 minutes at least, and get off your ass. I wrote this program for it, which also tells me to do certain exercises
                                                                                              • Get a keyboard that allows you to remap your keys. Move keys away from your pinkies as much as you can. Base your layout on what keys you actually need and how often, instead of just randomly moving them around.
                                                                                                • Something like the Ergodox or many of its derivatives should suffice
                                                                                              • Consider something like Colemak or other layouts as a base (in addition to the above). There is no hard evidence these layouts are better, but in my experience at least Colemak appears to reduce stress on my fingers compared to QWERTY
                                                                                              • Use a hand wrap or some sort of wrist compression sleeve, and put that around your wrist. I found this to help tremendously when I stopped using my palm rests in favour of hover typing.
                                                                                              • Rely less on pointer devices, though you are unlikely to be able to avoid them entirely. In order of worst to best: regular mice/trackpads, vertical mice, thumb track balls, finger track balls.
                                                                                                • I am using a Kensington Slimblade, after having used a variety of different mice types. It’s the first mouse that I don’t hate
                                                                                              • Get a good chair. Look for one where the back rest follows the natural curvature of the spine, and comes with some form of lower-back support (e.g. the posture-fit system in Aeron chairs)
                                                                                                • I have two Aeron chairs for this reason. They cost a lot of money, but they are absolutely worth it
                                                                                              • Get a headrest. Not to rest your head on, but to provide a reference for where you should keep your head. I found that I was hanging my head forward, and adding a head rest helped. I have it set up so that in the right position I barely feel it (it basically just touches my hair), which is enough to keep my head in the right position.
                                                                                              • Your upper legs should be at a 90 degree angle compared to your torso, and your lower legs at 90 degrees relative to your upper legs. Different angles can lead to a tingling feeling in your legs, an indication of reduced circulation or nerve pressure. Avoid that at all costs.
                                                                                                • So you should sit like `
                                                                                              • Realise that every case is unique, and that most people out there (including doctors) have no idea what they are doing when it comes to ergonomics. As such, you will have to experiment a lot to find out what works best for you
                                                                                                • I had a colleague who ended up off worse because she was made to do exercises by a doctor, which resulted in her muscles getting fried. IIRC she was unable to work for about half a year as a result.

                                                                                              There’s probably more, so I’m happy to answer any questions.

                                                                                              1. 13

                                                                                                5 minutes every 60 seconds

                                                                                                I know this is a typo but I swear I’ve worked with people who take 5 minute breaks every 60 seconds.

                                                                                                1. 4

                                                                                                  Oops! That is meant to say every 60 minutes; Unfortunately, it seems I can no longer edit the comment.

                                                                                                2. 1

                                                                                                  Thanks for sharing your views. I think the author would love to hear this. You should reach to @swyx on twitter.

                                                                                                  1. 1

                                                                                                    Kensington Slimblade

                                                                                                    Thanks for the recommendation. Just ordered one.

                                                                                                    I’ve already gotten a good deal of relief by turning my desk into a standing desk, but every little bit helps and I use the mouse more than I’d like given some of the very non keyboard friendly website I use for work.

                                                                                                    1. 2

                                                                                                      A tip for the Slimblade if you use a split keyboard: consider putting the Slimblade in the middle, and rotate it a bit so you don’t have to angle your wrist when using it. So instead of this:

                                                                                                      | o |   <-- Slimblade (sides parallel to your sides)
                                                                                                       | |    <-- hand
                                                                                                        \ \   <-- wrist
                                                                                                         \ \  <-- forearm
                                                                                                      

                                                                                                      You use it like this:

                                                                                                      \ o \   <-- Slimblade (rotated to the left by about 45 degrees)
                                                                                                        \ \   <-- hand
                                                                                                         \ \  <-- wrist
                                                                                                          \ \ <-- forearm
                                                                                                      
                                                                                                      1. 1

                                                                                                        Thanks. I’m not currently using a split keyboard, just a good mechanical.

                                                                                                        Always felt a little odd about pulling the trigger on an Ergodox or similar because of the price point. $200-ish on a good keyboard feels reasonable. $1000 does not. This is almost irrational on my part, but it is :)

                                                                                                        1. 3

                                                                                                          The Ergodox is definitely expensive, and takes some getting used to. In my case I switched from a HHKB2 Pro with QWERTY, so the Ergodox with a custom Colemak Mod-DH layout. I believe I have been using it for 9-10 months now, and only recently managed to hit 100 WPM (with very few errors). I think with QWERTY I sat around 120-140 WPM, but with a higher error rate.

                                                                                                          With that all said, I’m very happy with my setup; but it definitely takes some willpower to power through the first few weeks of typing very slowly.

                                                                                                          1. 3

                                                                                                            The split keyboard I use with my Slimblade in the middle is a Dygma Raise which still uses the standard staggered layout: https://dygma.com/ Here is a picture of someone else’s setup with an ELECOM trackball instead, looks similar to mine: https://twitter.com/DygmaLab/status/1280476663638364160

                                                                                                            I do have an ErgoDox EZ but, as long as I need to switch to other keyboards often, the Raise is a better solution overall with its negligible adaptation time back and forth.

                                                                                                            It’s a 60% (no numpad, function key row, navigation cluster) design meant for gamers and I do miss the function keys (not the cursor though: CapsLock + I/J/K/L) but so far it’s the best one I’ve found for my needs.

                                                                                                            1. 2

                                                                                                              Not sure where you got $1,000 from. Both my Ergodoxes (Infinity and EZ) were secondhand from eBay and I got them for about $150 each, but a new Ergodox EZ is $350. The Moonlander (from the EZ team) is $360 shipped.

                                                                                                              1. 1

                                                                                                                Yep I was totally wrong. I see $350.

                                                                                                          2. 1

                                                                                                            I’m using a Kensington Expert Mouse that has a scroll wheel around the ball, so I’m quite curious if SlimBlade’s approach to scrolling feels any good.

                                                                                                            1. 1

                                                                                                              Well I just plugged mine in and initial impressions are I REALLY like it. The ‘spin the marble’ approach to scrolling is super natural as it has tacile clicky feedback so you know you’re scrolling.

                                                                                                              Definitely a big upgrade from a regular old mouse.

                                                                                                              1. 1

                                                                                                                Before buying mine I read a review where the author wasn’t happy with it at all, saying that often, rotating the ball was misinterpreted as mouse movements. In my case it works wonderfully, and it even has a bit of built-in literal inertial scrolling: I spin it fast and it keeps going for a little while (around 1s) until it stops.

                                                                                                                1. 1

                                                                                                                  I’ll let you know with the proviso that all this stuff is SUPER subjective :) I thought about the expert but chose the slimblade both because of multiple recs here and elsewhere and because the smaller form factor works better for my super cramped desk.