1. 2

    Suggest plt tag, since this is more about a detail of the Nix language than an operating system.

    1. 2

      Agree. Is there a statute of limitations on tag editing? (edit: thanks!)

    1. 5

      A related rabbit hole that goes deep

      1. 5

        That is more of a parallel path, as BSD awk’s usually don’t implement these GNU awk extensions.

      1. 2

        Gonna try to hack the Gibson :-)

        It’s one of those weeks…

        1. 47

          Some of them seem to have concluded that the superiority of print debugging is some kind of eternal natural law.

          This looks like a strawman to me. I think that everyone would prefer a interactive, powerful, time-machine debugger. Whenever I use print debugging is when it is not worth the trouble of dealing with actually existing debuggers. I’m proficient enough in GDB, but not in PDB, so I print debug whenever I have to deal with python.

          Saying “but debuggers could be better” is not that interesting. My reaction is “99% of everything in computing - hypertext, screen sharing, data transfer etc. could be better, but that is not the position from which I get to decide what to use.”

          1. 5

            This looks like a strawman to me. I think that everyone would prefer a interactive, powerful, time-machine debugger.

            I definitely know people who sneer at the mere concept of a debugger. Or even print debugging. They just want to read and understand the code directly.

            1. 15

              Beware of bugs in the above code; I have only proved it correct, not tried it.

              – Knuth

              1. 11

                The most effective debugging tool is still careful thought, coupled with judiciously placed print statements.

                – Kernighan

                1. 7

                  Not to knock Kernighan, but he said that decades ago. We should have figured out something more effective while being just as easy to use and just as free by now.

                  1. 7

                    What has dramatically changed with debuggers over these decades? I’ve used interactive debugger in XCode recenty: it could as well be Turbo Pascal.

                    1. 7

                      The problem is Unix debuggers haven’t really caught up to Turbo Pascal. My experiences with 90’s Visual C++ have been nicer than gdb.

                      1. 3

                        The author of the post is explicitly advertising reversible debugging with rr. I guess he didn’t do it that well :)

                        When you hit a crash or invalid state, you can go backwards and find what caused it.

                        As I understand it, GDB does have reversible debugging, but it’s inefficient. rr works on x86 and Linux and is efficient. It’s impressive, but so far I’m getting by with regular GDB and IntelliJ. I would like to get in the flow with rr in the future.

                        1. 1

                          In my experience GDB’s reverse debugging is not inefficient, it just doesn’t work well. It cannot handle SSE instructions, doesn’t record the whole process tree, has issues with side effects etc. The two things I like about it when compared to RR is that you can choose to only “record” (it’s not actually a recording, as far as I understand it just forks the debugee) a small part of the program rather than the whole execution and that it works on more architectures than just x86_64. But these two advantages do not outweigh all the disadvantages it has when compared to RR, in my opinion.

                    2. 4

                      Sometimes our thoughts lead to questions, and answering those questions leads to more thoughts and more questions. Being able to answer many questions without having to rerun the entire program each time leads to more thoughts with less effort, leading to more effective debugging.

                      Debuggers are great is what I’m saying

                      1. 3

                        Things like rr, which is a recent thing, doesn’t work on my AMD hardware. So for the rest of us most debuggers give you the info in the reverse order… usually you need to work your way back to the problem so they don’t avoid rerunning the program.

                        1. 3

                          Things like rr, which is a recent thing, doesn’t work on my AMD hardware.

                          Yeah, incompatibility with AMD hardware is a serious drawback. However, initial support for AMD CPUs has been merged in the past year, so thinks are improving on that front.

                        2. 1

                          I agree about debuggers. I think Kernighan and Pike on debugging (and more) has been informative to me. I use a debugger almost daily, but I think sometimes a well placed print statement is all one needs.

                    3. 2

                      In a perfect (statically-analyzed) world debugging would be a last resort. I use print statements to contextualize myself far less often in a TypeScript or Haskell codebase than I do in say, a Python codebase where the input/output types of a function are not always documented, even at the library level.

                      1. 1

                        It this because the don’t understand debuggers or because they have “transcended” them?

                        1. 4

                          It’s because they find debuggers cause them to focus on the small problem of what is happening instead of the big-picture design problem that resulted in the bad behaviour. I think

                      1. 5

                        Pet peeves:

                        #!/usr/bin/env perl

                        use strict;

                        use warnings;

                        1. 4

                          or

                          #! /usr/bin/env perl                                                            
                          use Modern::Perl '2015';
                          
                          1. 5

                            I personally find it clearer to do

                            use v5.12; # or whatever
                            use warnings;
                            

                            Versions 5.11 and above automatically activate strict mode. Specifying the exact version number plus a line activating warnings isn’t too much boilerplate, I think.

                            1. 2

                              I like the Modern::Perl invocation because you get say too.

                              But it is an extra dependency for sure.

                              1. 2

                                use v5.10 and later should also enable say.

                                1. 2

                                  TIL, thanks.

                                  TBH I just started using Modern::Perl after getting the book. I’ve added the boilerplate as an abbrev in Emacs so I don’t have to bother with remembering it.

                            2. 2

                              also of note —

                              $ perldoc perldelta
                               ...
                              $ perldoc perl5120delta
                              
                                      use 5.12.0;
                              
                                  means:
                              
                                      use strict;
                                      use feature ':5.12';
                              

                              Also learned that 5.12 is Y2038 compliant

                              It may not mean much to you, but your kids will love it! :-)

                              1. 4

                                That’s good to know! My plan to live forever is working so far…

                            3. 2

                              Hahah, yeah, fair enough. I usually do all that (hm, well, not always env – there are some tradeoffs) but I figured if I was going to go old-school may as well go all the way. Inscrutable runtime errors are the spice of life, right?

                              1. 1

                                For those of us who haven’t used perl in a long time (and IIRC were taught this way), what should we be doing instead and why?

                                1. 1

                                  I think spetz was saying I /should/ have done those things but didn’t. If you learned to do things that way, I think you’re still good-to-go. Though some folks up-thread mentioned some other options that may have additional benefits if you’re running a recent-enough version of Perl.

                                  1. 2

                                    Exactly, my fingers automatic type strict and warnings when starting a new perl file. I read up on the other examples and I like them.

                                    Personally I don’t care for ‘say’ and use print/printf but there is other benefits. In my world mostly that the script will behave on a server the same way it does when developing it, and that’s a point I will take with me.

                                    1. 1

                                      Oh you’re no doubt correct, my bad, ty.

                                1. 4

                                  This is a story about how Go is awesome at creating these super small HTTP servers. Most of the time you can get away with just using the stdlib. Instead of spending hours learning how to config Nginx or some other webserver, it can be as efficient to write your own specialized server.

                                  For example, two months ago, one customer was serving their frontend using nodejs, and it was taking quite a bit of memory in the cluster. The docker image was also quite large with all the runtime. Two hours later, I had thrown together a statically built Go program that is specialized to serve SPA1. They have been using it happily ever since. And if they need some extra feature, I know that it will be as easy, or even easier for me to add exactly what they need.

                                  1. 8

                                    For what it’s worth I could have probably gotten away with something like this for Nginx config (I haven’t tested this but I’m at least 98% certain it would only need minor adjustments to work properly):

                                    server {
                                    	listen [fda2:d982:1da2:180d:b7a4:9c5c:989b:ba02]:43705;
                                    	location ~ ^/(?<service>[a-zA-Z]+)$ {
                                    		proxy_pass http://unix:/srv/within/run/$service.sock:/metrics;
                                    	}
                                    }
                                    

                                    However doing it with the Go standard library does get to show off how easy Go makes it to do amazingly hacky things without using anything but the standard library. Go is nice for these things. I wish that level of simplicity in usage was true about other aspects of the tooling like Go modules, but that’s a rant for another day.

                                    1. 3

                                      I wish that level of simplicity in usage was true about other aspects of the tooling like Go modules, but that’s a rant for another day.

                                      My thoughts as well. Reading your Go really reminded me of its (perhaps former?) “cultural agenda of radical simplicity”. Also, thanks to Mara for the NixOS service. Also love to see Nix get involved with anything :-).

                                  1. 4

                                    Have you tried running vim on Windows? I remember from way back when that this “just worked”.

                                    1. 2

                                      I had the same question. First thing I do with any Windows machine I’m forced to interact with is install cygwin with vim. But I started that habit many many years before WSL came around, which is what I guess you’re supposed to use nowadays.

                                      1. 2

                                        cygwin is great. you aren’t alone in doing it the “old” way.

                                        1. 2

                                          Neovim installs natively!

                                          1. 1

                                            Good to know. I haven’t setup a Windows machine since I switched to neovim. It will be interesting to see how much of my config works. :)

                                          2. 1

                                            I was thinking a native build of gvim, not the console Vim from cygwin. I seem to remember there being a native build around 2002 or so which you could download from the Vim website. That’s from before neovim AFAIK.

                                            1. 1

                                              Both GVim and Neovim work, and they work in the Windows Terminal without Cygwin, in my experience.

                                              Neovim actually has a pretty decent terminal emulator, so I end up using it a bit like tmux somewhat when I have a lot of terminal-heavy work to do.

                                        1. 2

                                          Lifting weights, working on getting up to speed with my new team, and trying to live on Linux as my daily driver.

                                          1. 2

                                            What distro are you running currently?

                                            1. 2

                                              NixOS. It’s a challenge!

                                              1. 1

                                                It’s worth it.

                                                1. 1

                                                  I’m writing about it. So far, so good.

                                          1. 2

                                            If only it helped. ;)

                                            This remains my favorite example: perl -e 'print reverse "dog"'

                                            The funniest thing is that not even the perldoc reference manual has anything that would prevent one from assuming that it will work as expected. The default context of built-in functions is never specified anywhere!

                                            1. 6

                                              reverse is documented here https://perldoc.perl.org/functions/reverse. The title is “reverse LIST”, which at least to me implies that the default context is list context.

                                              The reverse of a one-element list is the same list.

                                              perl -e 'print scalar reverse "dog"' prints god, as per the documentation.

                                              Edit structure

                                              1. 2

                                                A type error, or sensible duck typing. Or at least documentation that says that reverse() will treat scalars as one-item lists. Anything but what’s actually going on.

                                                1. 6

                                                  Context is key. reverse "dog" is equivalent to reverse ("dog"). One can argue that being able to refer to lists without enclosing parentheses is a wart.

                                                  But the documentation is clear that without the qualification using scalar the default context is list context.

                                                  I’m not going to say that Perl isn’t full of context gotchas, it is. But Perl’s documentation is generally clear.

                                                  1. 2

                                                    more on this can also be found via perldoc -f reverse

                                            1. 1

                                              Doing what feels like janitorial work on a code base. At least it’s nice to be “in the rear with the gear”, as it were.

                                              1. 1

                                                Interesting, I used to have some sort of tmux attach in my .zshrc but in my experience on servers I always had to check for sessions first or it would exhibit weird behaviour if the server had ben rebooted. Maybe screen is more intelligent or one of the flags is “reattach and autocreate if not existing”?

                                                1. 3

                                                  All of the terminals that I use these days provide a UUID in an environment variable. The macOS one preserves it across terminal restarts. I use the UUID for the remote session ID, so I can always reconnect (or autossh can for me). On macOS, I create a directory with a file containing the remote host name, whose name is the UUID and my .bashrc checks if this file exists and automatically reconnects. I can reboot my Mac and all of my SSH sessions reappear exactly where I left them.

                                                  I’ve moved from tmux to abduco recently, because tmux feature creep is annoying: I don’t want tmux to manage my scrollback, I have a terminal that does that. I don’t want tmux to do tabs / panes / windowing, I have a windowing system and terminal for that.

                                                  1. 1

                                                    Wow. abduco looks really neat and appears to mimic screen in the ways I use it daily. Thanks so much!

                                                1. 2

                                                  The Day 5 code gist got blocked in Firefox for me. Here’s the gist if anyone has/had same issue: https://github.com/nikhilm/AdventOfCode2020/blob/master/AdventOfCode-Tests/Day5Test.class.st

                                                  Also, OP - if you have not seen this great video with Bob Taylor, I highly recommend it. Interview contains bits about some of the people chronicled in “The Dream Machine”.

                                                  1. 1

                                                    Over the weekend was thinking it would be cool to have cwm but for Wayland. Resolved to make it happen.

                                                    Monday: I found it with hikari. I think this week might entail my restarting a NUC with FreeBSD in order to get Wayland working and Hikari running.

                                                    1. 5

                                                      FreeBSD is great! I haven’t booted my NUC with FreeBSD installed for a few months now, but back then it was a daily driver for most tasks.

                                                      I really agree with this:

                                                      FreeBSD has excellent documentation. The people on the documentation team really care about making the handbook useful. I wish it went into more detail about best practices for making your own services (I had to crib from some other service files as well as googling for a minimal template), but overall it gives you enough information to get off the ground.

                                                      Also, was watching Hackers (1995) last night and the “Devil Book” one Zero Cool mentions reminded me I need to switch that NUC back on.

                                                      1. 10

                                                        There’s a famous theory that denizens of the Star Wars fictional universe are functionally illiterate; they are post-literate and stand upon the ruins of several collapsed literate societies. This theory is largely motivated by a desire to explain how Roman-era politics could manifest in a supposedly advanced and progressive society which appears to have a strong multicultural (and, as is possible in sci-fi, multiracial) community; how can hyperdrive travel not beget lightspeed news?

                                                        But any student of history will realize that the very lens through which we view fictional universes is going to be artificially narrowed and equipped with a narrative. While it is true that sometimes civilizations collapse and permanently lose capabilities, we should be careful to imagine that this will always destroy our knowledge of how to rebuild society. Historically, this only seems to have happened when we lose the ability to read and write, as at the end of the Bronze Age.

                                                        1. 8

                                                          Nobody texts in Star Wars!

                                                          People didn’t text in 1977 when the original movie came out, and people really hate when stuff from the original trilogy is invalidated, so why bother changing it? Having people talk to one another on two-way radios means that the audience gets to witness their conversation without having to read, which is good, because the audience is children.

                                                          This is why there seems to be so much poverty in Star Wars: widespread ignorance.

                                                          … the entire plot of the prequel trilogy is “the Jedi are cops that uphold a system of slavery and exploitation and Anakin brings balance to the Force by destroying them because they are actually bad”. The subtext really is not that deep here. Anakin is born into slavery. His mother is a slave. He is “freed” by his Jedi Master to fulfill some prophecy; he is “freed” to be used as an instrument, and not because, and stick with me here, slavery is bad and people should be freed from slavery. The fact that he wasn’t freed from slavery because slavery is bad is only reinforced by the fact that Qui-Gon declines to free Anakin’s mother from slavery. At no point do the Jedi or does the senate say “hmm, maybe we should abolish slavery”. Anakin literally asks Qui-Gon if his mother will be freed and Qui-Gon says no. Why? Because she’s not useful to their goal of “maintaining order”. What order? Order for whom? What good is order to a person that is enslaved by that order?

                                                          even ancient Jedi records exist in the form of holograms

                                                          … the point of holocrons is that it requires the force to open a holocron. Opening a holocron is a Jedi skill. The entire point is that only Jedi can open a Jedi holocron, and that opening a Sith holocron requires tapping into the Dark Side. These things are plot points in Clone Wars and Rebels.

                                                          The final nail in the coffin which proves widespread illiteracy is how fast stories of the Jedi mutate from a fact of everyday life into legend, seemingly overnight.

                                                          uggggggh. The characters in the movie receive their information from oral tradition because they are proxies for the audience who -also- receives their information from oral tradition. When one character explains something to another character out loud in a movie, it’s because the point of the scene is to have that thing explained to the audience. This analysis is making me feel like I’m on crazy pills. It’s completely ignoring any practical consideration of filmed media, the audience being children, the realities of what could be depicted in the original trilogy, or the non-depiction of things to make them intentionally alien.

                                                          The alien languages in Star Wars are not real languages, they have no grammar, they’re just sound design, because Lucas wanted the alien languages to have no meaning. The point here is that you’re not supposed to be able to find out what they’re saying if you’re a big enough fan: the point is that you can never know what they’re saying because they are depicting something that is not observable to the POV characters. It’s not depicting the collapse of language and it’s not suggesting that the alien languages are not mutually intelligible to the aliens.

                                                          This is the same way Palpatine was able to take over in Revenge of the Sith. He simply said “the Jedi tried to kill me” and everyone was like, “okay.”

                                                          it’s a children’s movie that already had a 140 minute runtime. What do you want, an additional 15 minutes of people doing witness cross-examination to figure out the thing that the audience already knows to be true?

                                                          The Jedi seem to be the most educated people in the prequels

                                                          it’s almost like they’re the main characters?

                                                          Anyway, in the sequel trilogy, Rey steals the Jedi texts from Luke. They’re books. She doesn’t ever look at them like she doesn’t know what they are, and it’s taken for granted that she, a formerly homeless scavenger, would know how to read them. This whole “there’s no books because it’s depicting a post-literate society” really isn’t supported by anything other than “there aren’t books on the screen”.

                                                          1. 2

                                                            Nitpick: the sequel trilogy came after the piece theorizing about the SW universe being post-literary. I remember seeing the books in the movie and being reminded of the theory.

                                                            1. 3

                                                              totally fair and more than a nitpick. But still, I don’t think even in the original trilogy that there’s anything going on that suggests that people not visibly reading books has any meaning beyond “watching characters read a book in a movie is kinda boring” or “life in that galaxy sure is different from life on earth”. Also, R2 speaks to Luke in the original trilogy by texting to his console in the X-Wing, despite the fact that Luke is wearing a two-way headset that he uses to communicate with other characters and can understand R2’s bleeps and bloops and didn’t grow up in the Jedi academy. He grew up with … Uncle Owen, who this article suggest is illiterate because he’s never shown reading a book. In newer media such as Clone Wars, characters are depicted using computers in a way that suggest literacy on a number of occasions, but usually the focus is on the character’s face and their reaction to what they’re seeing than the screen itself. E.g., there’s a depiction of the archives in which a changeling disguises herself as a Jedi and uses one of the terminals to access some of the records and is depicted typing and using a search engine. I know, I know, this is extremely specific, but it’s just coincidence; I saw that episode the other day because I’m watching through Clone Wars for the first time.

                                                              It’s just a very flimsy interpretation that doesn’t at all stand up to scrutiny, and hinges on making assumptions about things that are not depicted instead of having much to say about things that are depicted.

                                                          2. 4

                                                            reminds me of a quote from Snow Crash:

                                                            We have a huge workforce that is illiterate or alliterate and relies on TV—which is sort of an oral tradition.

                                                          1. 3

                                                            Alan Kay didn’t coin the term “objects”. He explicitly credits SIMULA-67 in his Smalltalk-72 manual. He coined the term “Object Oriented Programming”.

                                                            Also, if you read his earlier writing, he didn’t consider objects to be the “lesser” idea. He treats objects, classes, and messaging as equally important. He only came to believe “messaging” was the big idea much later.

                                                            1. 2

                                                              Haven’t read anything original but have gotten through most of Dealers of Lightning which brought me to this post more or less. Thanks for mentioning SIMULA-67! Can’t wait to learn more.

                                                            1. 1

                                                              One of the architectures at stake is i386 .. We’re interested in the discussion about i386 support in Debian that was going on recently and that will probably continue in one form or another.

                                                              Anyone have any good links to those discussions? For and against.

                                                              1. 3

                                                                I loved this when I found out about it myself. A very kind user even reached out with some tips after I submitted my thanks. The Perl community seems great.

                                                                1. 6

                                                                  Firstly I’m looking for work again after 6 months of being a full time dad for my son. I have an interview later today so here’s hoping!

                                                                  Second I am (er…rather gingerly) showing people my side project and getting feedback. In short it’s an interface on top of your browser bookmarks which shows you discussions about your bookmarks, links between them, full text search, and so on. It’s sync-based so you can bookmark stuff on your phone and it will pick them up too - so long as you are also using browser sync. If anyone here has a few minutes to check it out, I’d love to hear any thoughts. Here’s a sharelink to one of my bookmarks to give a taste: https://quarchive.com/shares/idD41uGRH0RIMTPYBgM9PhXg

                                                                  1. 1

                                                                    Oh, the discussions feature looks interesting! Though, as if it wasn’t enough of a sinkhole & addiction browsing lobste.rs & HN, at least for me…… :/

                                                                    1. 1

                                                                      At least with this you’re looking at discussions of things you’re interested in I suppose! (I spend a fair amount of time browsing through comments on things I know nothing about)

                                                                    2. 1

                                                                      Good luck on your interview!

                                                                      1. 1

                                                                        Thanks mate! That one didn’t work out but very close on others!