1.  

    To some extent I agree, however if there is too much code in the constructor it also is quite often an indicator that the code should be refactored. The convenience of what the RAII principle is providing allows also to avoid coding and resource management mistakes/bugs. In c++ exceptions are considered to be used for exceptional circumstances, and they are quite expensive for binary size, at least I made that experience when I used to work on some bigger applications. On the other hand I have been writing a lot of python code in the last few years and exceptions are the defacto way to handle errors. And it’s very much not a problem to use exceptions for non exceptional use cases.

    In C++ I rather would argue that the approach of acquiring resources during initialization makes sense because it reduces your need for introducing checks that could lead to wrong code paths especially in the destruction. When applied correctly your program will be more robust if you use the raii principle. I recommend reading the exceptional C++ books by Herb Sutter those are very much still one of the best sources in writing C++ code that is handling exceptions properly.

    Complexity in constructors and destructors is something to avoid which is something as I understand is your main criticism to the principle.

    1.  

      it’s very much not a problem to use exceptions for non exceptional use cases.

      Agreed. Many dynamic programming problems are a good fit for backtracking with longjmp/“exceptions” which is how you’d write it in assembly anyway.

      Lately (well, sometime in the last couple decades) I’m thinking “exceptions” aren’t a good use for exceptional situations either. That is to say, we’re using exceptions exactly backwards.

      One of the best examples I’ve come up with is the out of disk space error. When you’re out of disk space, many programs will give up/crash – but consider the ergonomics of a CAD or video editing tool, that upon save starts moving this multi-gigabyte asset out to disk over what’s perhaps several minutes and then – oops! that partition is full.

      If we unwind, the (temporary) file needs to be cleaned up(deleted), the user informed to make room somehow – none of these tasks are straightforward – all the file opens to save this large asset need to be in on it, which is often tricky if the file-saving was done by a different team than the UI team (who handles the exception, and thus deletes the files).

      But what if we use a handler? We call the handler, from deep in the file saving code, and tell it “we’re out of disk space”. We can easily offer a callback to “retry”, and a list of any (temporary) file created so far so that they can be deleted (or moved onto another disk, or whatever). This could be provided by the UI team, but if not the operating system could have a crude “abort retry fail” dialog. We live in a multitasking world these days, so that’s probably good enough for a lot of enterprise applications – use goes and moves those files around and then resumes the save (by returning from the handler).

      1.  

        That is exactly the approach taken by Common Lisp’s condition system (which is used for more than just errors, but also for general notifications. It’s extremely powerful, and an illustration of how Lisp really is an industrial-strength language for real problems.

    1. 6

      This is pretty far off-topic, and most likely to result in a bunch of yelling back and forth between True Believers.

      Flagged.

      EDIT:

      OP didn’t even bother to link to the claimed “increasing evidence”. This is a bait thread. Please don’t.

      1. 17

        Shrug. I find the complete lack of political awareness at most of the tech companies I’ve worked at to be rather frustrating and I welcome an occasional thread on these topics in this venue.

        1. 13

          It’s possible that many of your coworkers are more politically aware than they let on, and deliberately avoid talking about it in the workplace in order to avoid conflict with people who they need to work with in order to continue earning money.

          1. 1

            All work is political. “Jesus take the wheel” for your impact on the world through your employment decisions is nihilistic.

            1. 8

              Not trumpeting all your political views in the workplace does not mean completely ignoring political incentives for employment or other decisions. I’m not sure what made you think GP is advocating that.

        2. 3

          Obviously “off-topic-ness” is subjective, but so far your prediction re: yelling back and forth hasn’t happened. Perhaps your mental model needs updating… maybe your colleagues are better equipped to discuss broad topics politely than you previously imagined?

          1. 4

            Obviously “off-topic-ness” is subjective, but so far your prediction re: yelling back and forth hasn’t happened.

            Probably because everyone on this site is good and right-thinking — or knows well enough to keep his head down and his mouth shut.

            (Which has nothing to do with the truth of either side’s beliefs; regardless of truth, why cause trouble for no gain?)

            1. 5

              To me, the people on this site definitely handle these discussions better. Hard to say how much better given that’s subjective. Let’s try for objective criteria: there’s less flame wars, more people sticking to the facts as they see them vs comments that re pure noise, and moderation techniques usually reduce the worst stuff without censorship of erasing civil dissenters. If those metrics are sound, then Lobsters community are objectively better at political discussions than many sites.

            1. 5

              These all seem to say one thing: climate change is going to be worse faster than some other prediction said. But that does not even remotely address your claim that “organized human life might not be possible by the end of the century and possibly sooner”. What on earth makes you think you know anything about what conditions humans need to organize?

              1. 1

                This is a good point. I guess my “evidence” would be past civilization collapse as a result of environmental destruction like what happened on Easter Island.

          1. 5

            For websites: Firefox Sync :-) Everything that isn’t a website or is important enough to have more than 3 copies (laptop, workstation, phone) lives in a keepass file, hosted on a nextcloud instance.

            1. 2

              Do note that Firefox Sync has a pretty nasty security flaw: your passwords are ultimately protected by your Firefox Account password — so you need to make sure that it’s a high entropy one (like 52ICsHuwrslpDl6fbjdvtv, not like correct horse battery staple). You also need to make sure that you never log into your Firefox Account online: Mozilla serve the login UI with JavaScript, which means that they can serve you malicious JavaScript which steals your password (this is worse than a malicious browser, because someone might actually notice a malicious browser executable, but the odds of detecting a single malicious serve of a JavaScript resource are pretty much nil).

              I use pass, with git-remote-gcrypt to encrypt the pass repo itself (unfortunately, pass has a security flaw in that it doesn’t encrypt filenames).

              1. 2

                I’m pretty sure the password isn’t used directly but derived into a crypto key using PBKDF2 on the client.

                1. 3

                  This does not protect you from physical access (if you ever let your computer unlocked). It took me 10 seconds to discover that firefox lets anyone see the plain password of every account.

                  https://i.imgur.com/lbxmMow.png

                  1. 3

                    If you use a master password, you have to enter that to see the plain password in that dialog.

                    1. 1

                      That makes more sense.

                    2. 2

                      True! imho physical access should be countered with something else. Lockscreens, hard disk encryption etc.

                      1. 1

                        Yes, of course if there is a physical access there is no much hope left: even with ssh, if ssh-agent is running or a terminal with a recent sudo and much damage can be done.

                        What did surprise me is how fast and easy it is to go straight to the password.

                    3. 1

                      Yes, but that doesn’t add any entropy: if your password is ‘love123,’ it’s still low-entropy, even if it’s stretched.

                      Remember, too, that the client-side stretching is performed by JavaScript Mozilla delivers when you attempt to log in — as I noted, they could deliver malicious JavaScript at a whim (or under duress …).

                1. 3

                  I mostly use Firefox Sync. That and Safari/iCloud. The Single Source of Truth is a paper booklet I bound myself. I used to use an encrypted org-file w/ Emacs, which was really nice, but it was not super convenient (and I did sync w/ Dropbox, just not my keys!).

                  As for generation, I start rolling 5 d6 and open diceware.txt . The OS X Password Assistant is pretty good, but my preference has shifted to diceware.

                  1. 1

                    It’s fine to use Firefox Sync as long as you’re aware of the security issues & take appropriate countermeasures; see my other post. I’m worried that some people don’t realise how broken the Firefox Account model is, and rely on it more than it deserves.

                    1. 1

                      Cool, thanks. How many bits of entropy are we talking about? The example you posted looked to be maybe 120? bits. Correct horse.. should be around 50 bits. Is 80 enough?

                      My main concern so far is the authenticity of the password prompt, it’s just totally unstyled and I can’t tell/remember if it’s really Firefox asking, especially when I haven’t really tried logging into anything (even though it syncs bookmarks too) so I often hit cancel.

                      1. 1

                        I believe that keys should be 128 bits of entropy, so don’t consider 80 enough. It may be a bit overkill, but security is important — and recording or memorising a single super-password is easy enough anyway.

                  1. 1

                    I just always run into the issue of my eshell buffer becoming huge and getting really slow. I’ve looked online for a way to tell emacs to “chop off” or “empty” the current buffer, with no luck.

                    1. 1

                      I just always run into the issue of my eshell buffer becoming huge and getting really slow. I’ve looked online for a way to tell emacs to “chop off” or “empty” the current buffer, with no luck.

                      I’ve not been an eshell user until I read this article today (we’ll see if I stick with it), but the first thing I tried was the normal emacs editing commands: I selected some text and then hit C-w (kill-region). It did exactly the right thing.

                      … and then I discovered that it can only remove the output of a single command at a time. That’s really annoying.

                      It does look like killing & recreating the buffer does work. How very annoying; one would have thought that it’d have been fixed by now.

                    1. 2

                      I don’t really see the problem here. The cost of mining & materials is already priced into every phone (assuming that manufacturers and their suppliers are profitable). If there are externalities, surely they’ve already been factored in as well by this point in history. If not, then surely we can fix that.

                      If someone has the income to buy a new phone every few years — that’s his money and his choice.

                      1. 12

                        Cool article, but not what I expected from the phrase window manager!

                        1. 9

                          In hindsight, I guess the tag should have given it away. But I enjoyed the surprise as well :)

                          1. 1

                            Missed the hardware tag too. Been looking at electric blinds recently and the off the shelf ones seem prohibitively expensive.

                            1. 2

                              TechCrunch Disrupt 2019: “Electric Blinds Meets Machine Learning Monitored and Controlled via a $5 Droplet!”

                              1. 2

                                Author here. Although the raw material I used is <10$, as a rule for all DIY projects you should always consider the time and equipment needed. I’ve seen some motorized shades for ~200$, which for a finished/professional product is quite ok.

                            2. 2

                              It doesn’t even support ICCCM!