Threads for alanz

  1. 3

    With respect to linked lists, a colleague referred me to https://rust-unofficial.github.io/too-many-lists/ when I was learning, and I found it a very good introduction, covering the intricacies of the various lifetime and related issues.

    1. 1

      How does this relate to the approach in QuickCheck? From a quick scan of the article it seems similar.

      1. 2

        Well, the way you go about using tools like QuickCheck and RMC is perhaps similar, but the way they actually work under-the-hood is actually quite different. For example, RMC uses CBMC which means it does symbolic execution of the program — that is, it doesn’t actually execute the code. Whereas QuickCheck does actually execute the code and must try a lot of inputs to find useful stuff.

      1. 1

        The motivating example of lazy loading sounds like a thunk in haskell. Only evaluate it when needed.

        1. 20

          A related good idea is Architecture Decision Records to explain and justify how the architecture evolved over time.

          1. 8

            Getting LSP integrated pervasively in Emacs in a way that it reliably just works and performs well out of the box

            I don’t get how this should work, when setting up LSP servers is now the issue. If you want to use rust-analyser, you have to download rust-nightly. If you want to use a Java LSP server, you have to do class-path magic. If you want to use a Python LSP server, you’ll have to let pip download every single python library again to get the right versions. If you want to compile a Haskell LSP server, you’ll need to buy some more RAM.

            But if this would be solved, and all I have to do is run “sudo package-manager install java-lsp-server”, then it would be a considerable advancement. The best one can do, as I understand is planned for 28.1, is to get Eglot into a working and stable state, so that it’s ready for when the server implementations have matured.

            Having a wizard showing up in new Emacs installations might be a great low-hanging fruit way of making Emacs more accessible.

            I have discussed this on the mailing list, but haven’t ever had the time to implement this myself (yet). What Emacs needs is a wizard language, that can be used to teach Emacs itself, but also any package (just like ert is used for tests). Most proposals haven’t been too pretty though.

            Take a look at the screenshots of these Neovim GUIs:

            I don’t see any notable difference, tbh. What I would get is better integration into window managers (opening downloaded files in existing emacs sessions), but I have never understood what neovim actually achieves by splitting UI and backend. Sure, it’s a good design decision in principle, but considering the complexity of Emacs display engine, I’m not sure if it is worth it.

            It is very easy to either freeze Emacs or cause it to run very slowly. Multiple times a day I have to hit C-g incessantly to bring it back from being frozen. When that fails, I am sometimes able to get it back with pkill -SIGUSR2 Emacs. At least once per week I have to pkill -9 Emacs because it turned completely unresponsive.

            I used to have these problems, but in my experience this comes from fighting Emacs instead of cooperating with it. Using unnecessary packages, weird themes and wanting popups everywhere will simply slow stuff down. The main parallelism in Emacs is done by starting external processes, since Emacs is more of a Unix shell than Lisp machine.

            It would be great to have more and more of these influencing and being incorporated to the Emacs Lisp standard library and made to be very performant.

            Please not, dash and s are quite annoying and don’t always lend themselves to idiomatic Elisp (I understand they are influenced by Clojure, which has a difference heritage). seq.el and map.el are nice, but since they are based on generic functions, they are often slower.

            It would be great to move to a forge style of contribution.

            As long as it doesn’t require new accounts, and everybody is free to participate in the conversations, ok, but I’ve only seen this implemented by source-hut, and none of the GitHub clones that have spoiled so many people.

            1. 6

              Emacs is more of a Unix shell than Lisp machine

              Strongly agree with this. It’s extremely good as a “visual shell” / UI framework. It’s not usually a good UX when you try to implement too much of your world in Elisp with dozens of packages, spinners, networking, etc. You end up in C-g hell as the author describes. Over 15 years of usage I’ve actually evolved away from the “rewrite everything in Elisp” view and towards “drive scripts from Elisp and slurp results into a buffer for processing”

              Please not, dash and s … don’t always lend themselves to idiomatic Elisp

              Also agree. Writing idiomatic Elisp using the built in APIs isn’t that hard, but it’s more “old skool” and can be imperative/verbose, so I guess some people don’t like it

              On the other hand I think it’s kind of dumb to have to import a “cool” string library to install a library that does something I actually want.

              Elisp isn’t Clojure and I’m glad for that. I think a lot of the complaints are that it isn’t Clojure/CL/etc, but its not supposed to be. It’s basically a 70s era MacLisp clone.

              In general I think two (no three) things:

              1. People can write whatever they want to write, it’s free software, their itch etc
              2. I wish a lot of the people trying to make Emacs “better” (by their definition) but who are also possibly adding complexity to the code base, changing variables and APIs and default settings etc would just chill and learn more about what it is they’re trying to change before concluding “this needs feature X, let’s hack it in and now everyone has to live with it”
              3. I know #2 is something of a straw man and not 100% fair but Emacs is where I live all day every day and somebody else’s “cool new feature” is my “unnecessary risk and complexity” (and possibly lost hours troubleshooting)
              1. 5

                Take a look at the screenshots of these Neovim GUIs:

                I don’t see any notable difference, tbh. What I would get is better integration into window managers (opening downloaded files in existing emacs sessions), but I have never understood what neovim actually achieves by splitting UI and backend. Sure, it’s a good design decision in principle, but considering the complexity of Emacs display engine, I’m not sure if it is worth it.

                The exactly same thing has been said for vim, yet neovim managed to pull if off. Just for the sake of it being a great design decision, it would be worth implementing it. The case in points are so many different forks of emacs, trying to make it run on different platforms (emacs-mac, xemacs, …).

                1. 4

                  I don’t get how this should work, when setting up LSP servers is now the issue. If you want to use rust-analyser, you have to download rust-nightly.

                  This imo is exactly the problem which should be solved by editor’s extension. In VS Code, the user just installs the rust-analyzer extension and the binary is downloaded automatically. IIRC, coc-nvim provides a similar experience.

                  It is important that LSP support in an editor allows for each language to have a dedicated, easy discoverable plugin which deals with dirty integration bits.

                  1. 4

                    I’ve had pretty hit-or-miss luck with things actually working in VS Code when you do that. Just yesterday I tried using it for C# for the first time, responded “yes” to the prompt when it asked if I wanted to install the recommended C# extensions, and now I have some kind of dependency hell around .NET version mismatches (“Error: The reference assemblies for .NETFramework,Version=v4.7.1 were not found.”). Some of the language extensions install without problems, but I’ve come not to expect it.

                  2. 3

                    If you want to compile a Haskell LSP server, you’ll need to buy some more RAM.

                    haskell language server provides precompiled binaries that transparently download for vsode, and lsp-mode is working on reusing this ability.

                    You can also install prebuild binaries via ghcup

                    1. 3

                      That’s basically the same problem as with rustup, that I have to install software from external sources, instead of having it all done by my (system’s) package manager.

                      1. 3

                        You can consider using Nix to declaratively create project development environments that includes build tools like LSP servers, which is exactly what I do in my open source Haskell project (run nix-shell --run "code ." and things “just work”, be it on Linux, macOS or WSL).

                    2. 2

                      I used to have these problems, but in my experience this comes from fighting Emacs instead of cooperating with it. Using unnecessary packages, weird themes and wanting popups everywhere will simply slow stuff down.

                      I don’t think it’s productive to put blame for these problems on the user. Extensibility is the main selling point of Emacs for many, people use it because they want those features. Of course it’s always possible to shot oneself in the foot. But if some of the problems are solvable on the level of platform, they should be solved there. When I pick a theme I want to pick it for its look and not think if it will slow down my editor. If an extension delays startup, becomes unresponsive or slows down every key stroke I want to be told by Emacs about what’s to blame but I also want it to be hard to achieve.

                      It shouldn’t be as easy to bring the editor to a crawl. The user doesn’t have to be an expert or to use vanilla Emacs for it to be fast. The machine I’m typing this on has 8 cores, I don’t see why crazy computations to paint parentheses in rainbow colours should slow down my typing or scrolling. I think support for asynchronous execution is one of the main reasons why Neovim succeeded.

                      1. 1

                        Hard agree.

                        1. 1

                          Extensibility is the main selling point of Emacs for many, people use it because they want those features.

                          What features? My comments are more related to UI stuff like pop-ups or constant redrawing effects – in other words non-functional aspects. They can be nice and fun, but since most of the time they are hacks, it’s nor surprising that they aren’t efficient.

                          If an extension delays startup, becomes unresponsive or slows down every key stroke I want to be told by Emacs about what’s to blame but I also want it to be hard to achieve.

                          The problem here is that there is no such thing as an extension. There is no means to distinguish between the core and (so-called) extension, because they are equal.

                          It shouldn’t be as easy to bring the editor to a crawl.

                          As an editor, yes, but again Emacs is a fully programmable environment. Evaluate

                          (defalias 'eval #'identity)
                          

                          and slowly everything will start to break. Emacs’ power necessarily includes the ability to break stuff. The barrier can be lowered, but adding more (finite) computing power doesn’t solve the “issue”.

                        2. 2

                          If you want to use rust-analyser, you have to download rust-nightly.

                          rust-analyzer provides pre-built binaries

                          1. 1

                            But if this would be solved, and all I have to do is run “sudo package-manager install java-lsp-server”, then it would be a considerable advancement.

                            I’ve only tried clangd, which I was able to just grab via my distro’s package manager and it just worked (other than that every few hours clangd gets OOM killed…)

                          1. 3

                            Can you be on more than one leaderboard at the same time?

                            1. 3

                              Yes

                              1. 3

                                Yes!

                              1. 24

                                I have taken to using the --force-with-lease flag instead of just --force. It gives some protection that the repo you are pushing to hasn’t been changed by someone else in the meantime, and you trash that work.

                                See e.g. http://weiqingtoh.github.io/force-with-lease/

                                1. 7

                                  I really wish --force-with-lease was simply --force, and that this latter option was something like --force-for-reals. Saner defaults are always a good thing.

                                  1. 1

                                    Great tip! Thanks

                                    1. 1

                                      Oh this is great! Thanks

                                      1. 1

                                        I learned about this after overwriting a coworker’s commit. Excellent flag, should really be the default for -f

                                      1. 12

                                        i think the insanely low contrast setting that seem to be the fashion now probably contribute more to cognitive loading.

                                        And I am a proud light-theme, decent contrast user.

                                        1. 4

                                          GHC has a pretty good system for this, where they use the concept of a Note which is a short link to a longer comment in the same or a different file. e.g.

                                          tcTyClGroup :: TyClGroup GhcRn
                                                      -> TcM (TcGblEnv, [InstInfo GhcRn], [DerivInfo])
                                          -- Typecheck one strongly-connected component of type, class, and instance decls
                                          -- See Note [TyClGroups and dependency analysis] in GHC.Hs.Decls
                                          tcTyClGroup (TyClGroup { group_tyclds = tyclds
                                          ...
                                          

                                          And this is used to justify any particular decision that has been taken.

                                          1. 3

                                            I am currently experimenting with TiddlyWiki and its journal feature which has a stated goal of being self-contained and staying usable for the long term. And has many options for storage.

                                            1. 2

                                              What mechanism do you use to save (and sync across machines) tiddlywiki pages?

                                              1. 2

                                                I would be interested in this as well unless op is thinking about using a hosted tiddywiki instance.

                                                1. 1

                                                  I have Caddy with the webdav and jwt plugins. It works great until the jwt expires, so turning off autosave is a must.

                                                  1. 1

                                                    I am still experimenting. Right now I use the node based server on my laptop, running against a data directory in a Dropbox folder. But this is more for backup than sync.

                                                    1. 1

                                                      My ideal case would be any solution that involves each save directly writing to the local file (a Chrome extension, perhaps?), so I can just sync that file in Keybase filesystem, and get automatic sync as a result.

                                                  2. 2

                                                    a lot of people complain that tiddlywiki becomes unusable once you have too many tiddlers. I’ve tried it out and it works but i’m backing out for this reason

                                                  1. 5

                                                    What is an “disinterested obsession”? Isn’t that an oxymoron?

                                                    1. 12

                                                      ‘disinterested’ does not mean ‘uninterested’. It means ‘without expectation of personal reward’.

                                                      1. 2

                                                        Yet another word probably borrowed from French: désintéressé has exactly the same meaning.

                                                      2. 5

                                                        I read it as “disinterested in earning money from an obsession”. But that’s just because I believe the author is writing from his position as venture capitalist, where “obsession for customer satisfaction” is something people can say with a straight face.

                                                        1. 5

                                                          To me it is pretty clear

                                                          A bus ticket collector’s love is disinterested. They’re not doing it to impress us or to make themselves rich, but for its own sake.

                                                          It is an intrinsic motivation, rather than one driven by anything at all from the outside.

                                                          1. 2

                                                            I see. They come from a world where “interest” is only defined in financial terms.

                                                            1. 2

                                                              I personally think Paul Graham is such a person. I’ve never met him though.

                                                          2. 4

                                                            “Disinterested” and “uninterested” are not synonyms.

                                                            1. 3

                                                              Synonyms & Antonyms for disinterested

                                                              Synonyms

                                                              apathetic, casual, complacent, incurious, indifferent, insensible, insouciant, nonchalant, perfunctory, pococurante, unconcerned, uncurious, uninterested

                                                              https://merriam-webster.com/dictionary/disinterested

                                                              1. 2

                                                                I think this is more a recognition of how people use the word (incorrectly or otherwise). For many people, they’re synonymous even though they’re actually not. But this is the prescriptivist vs descriptivist divide, really.

                                                          1. 4

                                                            For me one of the main benefits of strongly typed functional programming (e.g. Haskell) is precisely that it reduces cognitive load.

                                                            In pure code, the inputs and outputs are clearly defined, and you know there can be no side effects in called functions.

                                                            For code with effects, this is made apparent, and so can be looked at more carefully.

                                                            1. 2

                                                              I agree. I think it’s fair to take this to the next step: which tools and languages automatically reduce load? But even in pure FP, you can end up with symbol leakage from underlying systems that you trust that do things you didn’t expect. One of the nice things about the onion architecture is that it forces you to come to terms with all of that right up-front. One of the things I don’t like about railway programming is that you can endlessly put off making business decisions because you’re not forced to think through leakage right away, at the point of consumption.

                                                            1. 2

                                                              In my view this is how true tech learning takes place. You are focused on solving a specific problem, so are concentrating hard on the details as you go along. And there is a dopamine reward for working it out.

                                                              Which of course is exactly what the article says. Consider this vehement agreement.

                                                              1. 2

                                                                There is an update published at https://blog.mozilla.org/addons/2019/05/04/update-regarding-add-ons-in-firefox/

                                                                The TLDR is they are using the “studies” mechanism to auto-push an update, provided you opt in to “studies” until it is done.

                                                                1. 0

                                                                  The add-ons are working for me, so it seems to have been effective.

                                                                1. 13

                                                                  I find the single most useful thing has been using it as a place to ask myself questions, and answer them.

                                                                  This has been a revelation for me over the past few months. I’d heard people say things like this in the past, but I never quite clicked that they actually meant “ask yourself a question” rather than “think about something”.

                                                                  If I ask myself a question, out loud if possible, and then attempt to answer it, I’m often surprised by the outcome. Half of the process is iteratively refining the question itself, the other half refining the answer.

                                                                  1. 6

                                                                    There’s probably psychological research on this but I’ve been thinking that maybe thinking itself is meant to be collaborative or competitive, at least in a lot of contexts, and that’s why language is such a big part of thought. And if dialogue is linguistically, rhetorically, communicatively a good way to explore a topic or question, then I should probably have dialogues with myself too. Like, why would an inner monologue be better than an inner dialogue?

                                                                    1. 2

                                                                      Dialogue is a very natural thing as well, have you ever argued with yourself over a purchase? How about an implementation?

                                                                      1. 2

                                                                        I think this technique ties in to the same brain machinery as Rubber duck debugging, with similar good effects.

                                                                        1. 1

                                                                          As far as I’m aware, thinking evolved from language, so it being “naturally” collaborative absolutely makes sense.

                                                                          Part of it (at least for me) is that it’s far easier to stay on topic when I’m participating in a dialog; even when that dialog is with myself.

                                                                        2. 6

                                                                          It also reminds me of one of my favorite papers that I re-read often (although not often enough): https://www.microsoft.com/en-us/research/uploads/prod/2016/12/State-the-Problem-Before-Describing-the-Solution.pdf

                                                                          1. 2

                                                                            Good callout. I thought this was one of the key insights in the article as well.

                                                                          1. 2

                                                                            http://git-annex.branchable.com/ is also an option, it is specifically designed to manage large data sets, distributed across varied storage repositories, include glacier, S3, WebDAV etc.

                                                                            And you can set policies of how many copies you want of various things, what is available in your “working set” on specific machines, and so on.

                                                                            The biggest drawback (for me) is that as it is git based, it doesn’t play nice with archiving directories that have git projects in them. Or didn’t when I last looked.

                                                                            1. 2

                                                                              git annex is great software, but you are right about not being able to store git in it.

                                                                              I use a combination of git annex and borg backups currently. Am slowing designing/thinking about a tool to replace both these use cases.

                                                                            1. 7

                                                                              I think the DOD-STD-2167 waterfall requirement came from a desire to harmonise the software development with the hardware development, and probably originated in thinking of projects where the software is a tiny part of the whole.

                                                                              1. 9

                                                                                This looks really neat but the whole “you have to have a bug-for-bug identical-with-node JSON serialization routine” for the signature stuff has always rubbed me the wrong way. Have there been any non-node implementations out in the wild yet? Last I looked the reference implementation was the only one you could actually use.

                                                                                1. 13

                                                                                  This is exactly the use-case canonical S-expressions were designed for.

                                                                                  As an advantage, they’re more attractive than JSON, and encourage better practices. E.g.:

                                                                                  {
                                                                                    "name": ["createHistoryStream"],
                                                                                    "type": "source",
                                                                                    "args": [{"id": "@FCX/tsDLpubCPKKfIrw4gc+SQkHcaD17s7GI6i/ziWY=.ed25519"}]
                                                                                  }
                                                                                  

                                                                                  Might be:

                                                                                  (create-history-stream
                                                                                    (type source)
                                                                                    (id (ed2559 |@FCX/tsDLpubCPKKfIrw4gc+SQkHcaD17s7GI6i/ziWY=|)))
                                                                                  
                                                                                  1. 4

                                                                                    Personally, I’d use bencode. It was literally designed for use in P2P protocols, and it’s length-prefixed, so you can pass arbitrary stuff in it without having to escape anything. And there’s already good implementations of it in Node (because BitTorrent uses it).

                                                                                    1. 4

                                                                                      Note that canonical S-expressions are also length-encoded: the example I gave actually looks like this on the wire:

                                                                                      (21:create-history-stream(4:type6:source)(2:id(7:ed2551932:%<"8BAh={/f)))

                                                                                      Assuming I didn’t mess up, that would be transport-encoded as:

                                                                                      {KDIxOmNyZWF0ZS1oaXN0b3J5LXN0cmVhbSg0OnR5cGU2OnNvdXJjZSkoMjppZCg3OmVkMjU1MTkzMjoUJf+2wMum5sI8op8ivDiBz5JCQdxoPXuzsYjqL/OJZikpKQ==}

                                                                                      The advantage over bencode is that there’s an attractive advanced representation, which is what I wrote in my post, rather than only the wire representation. The bencode version would, I think, look like this:

                                                                                      l21:create-history-streaml4:type6:sourceel2:idl7:ed2551932:%<"8BAh={/feee

                                                                                      I think that the canonical S-expression’s wire format is much easier to read by hand, don’t you agree?

                                                                                      1. 3

                                                                                        Huh, TIL. Then in that case, it probably would be pretty good.

                                                                                        1. 1

                                                                                          I wonder if the ease of reading problems couldn’t be fixed with a better text editor, making the debates between most of these essentially equivalent formats ‘moot’.

                                                                                          {  "create-history-stream" : {
                                                                                              "type": "source",
                                                                                              "args" : [{"id": "@FCX/tsDLpubCPKKfIrw4gc+SQkHcaD17s7GI6i/ziWY=.ed25519"}]
                                                                                            }
                                                                                          }
                                                                                          

                                                                                          aka

                                                                                          81 b5 63 72 65 61 74 65 2d 68 69 73 74 6f 72 79 2d 73 74 72 65 61 6d 82 a4 74 79 70 65 a6 73 6f 75 72 63 65 a4 61 72 67 73 91 81 a2 69 64 d9 35 40 46 43 58 2f 74 73 44 4c 70 75 62 43 50 4b 4b 66 49 72 77 34 67 63 2b 53 51 6b 48 63 61 44 31 37 73 37 47 49 36 69 2f 7a 69 57 59 3d 2e 65 64 32 35 35 31 39
                                                                                          

                                                                                          This could be kept in messagepack form, and just shown to the developer as json or s-exp or whatever you want in your favorite text editor. If anything the necessity for “human readable” files as plaintext or some specific format if anything an expression of the limitations of our tooling, as well as a lack of standards of encoding one format in another. If there were a standardized encoding between formats you could simply use the encoding that worked for you, and translate any implementation trivially.

                                                                                          1. 1

                                                                                            It’s an interesting idea, but different formats have different styles. E.g. JSON tends to like objects, which are unordered maps; canonical S-expressions tend to be built on ordered lists, often of key-value pairs; other formats have their own styles.

                                                                                    2. 8

                                                                                      There is currently an effort underway to rework the protocol to avoid that JSON serialization order misfeature.

                                                                                      See https://spec.scuttlebutt.nz/messages.html#legacy-json-encoding

                                                                                      This should also allow implementations in other languages.

                                                                                      1. 5

                                                                                        Web standards are slowly migrating to using CBOR for deterministic order and raw byte friendlines. An example: https://www.w3.org/TR/webauthn/#conforming-all-classes

                                                                                        1. 1

                                                                                          Thanks for the info; hope this lands soon.

                                                                                        2. 7

                                                                                          I know, right? These folks are all like “boats do not have always-on internet connections” and I’m all like “but they have quad-core CPUs and double-digit megabits of memory?”

                                                                                          1. 9

                                                                                            The other big thing I’ve noticed is that while it’s perfectly fine with ssb for your connection to be down most of the time, heaven forbid that your connection be metered. Initial sync upon joining a pub or following anyone can potentially be hundreds of megabytes – make sure it doesn’t happen on mobile data.

                                                                                            1. 3

                                                                                              A $20-$30 secondhand smartphone can easily manage quad-CPU and a gigabyte of ram.

                                                                                              1. 2

                                                                                                I hear you. I must point out that a gigabyte isn’t tens of gigabits and actually a quad-core phone would cost more like $50-70, right? I dunno, I haven’t bought a phone in a while.

                                                                                                It should be clear what I want though, right? Something that isn’t node.js or electron. Something that feels like weechat or mutt, or even keybase’s CLI. (Though, it is a performance hog, the background processes are.. maybe node.js? Something heavy.)

                                                                                              1. 1

                                                                                                I googled around for a bit and found this, which seems to be related. https://godoc.org/go.cryptoscope.co/ssb

                                                                                                How can somebody who doesn’t know much about go nor about ssb figure out what this repo is?

                                                                                                There are 14 branches in the repo. Is ‘master’ what most people would want?

                                                                                                1. 2

                                                                                                  It’s been a while, but I think it’s something like:

                                                                                                  git clone git@github.com:cryptoscope/ssb.git
                                                                                                  cd ssb/cmd/go-sbot
                                                                                                  go build
                                                                                                  ./go-sbot
                                                                                                  

                                                                                                  … open a browser and go to http://localhost:8008

                                                                                              2. 1

                                                                                                Is that the reason there is no browser only client?

                                                                                              1. 3

                                                                                                Very nice. I like the idea of DHT to share contents and still keep everything on your phone. I must admit I’m kind of lost after installing the app though: how do I add people? Are there ‘public’ posts? If so, how do I find them? I will of course look every question up, but a small intro would be nice…

                                                                                                1. 8

                                                                                                  If you can’t get the dht connection to work with a friend, get an invitation from one of the connection points (pubs) listed here

                                                                                                  https://github.com/ssbc/scuttlebot/wiki/Pub-Servers

                                                                                                  and paste it into the network “Paste Invite” box.

                                                                                                  Pubs basically introduce you to the network initially, so you can build up a set of peers to connect to, and after that are not needed.

                                                                                                  Because it is an offline-first network, your phone keeps a copy of all your peers on it. As such the initial sync (especially from a pub) may take a while, and use a lot of data, so wifi connection is a good option if it is cheaper for you.

                                                                                                  And the app will be fairly unresponsive during the initial sync. This is early stage tech, not completely polished yet.

                                                                                                1. 2

                                                                                                  I am amazed at how many there are.