1. 12

    This is the worst possible format for sharing information.

    1. 2

      Working nights at a side-job and working on a script that nicely compiles all my markdown notes into a PDF in a specific way.

      1. 6

        Is there a reason that the entire body of the site is set as the title? I’ve never seen that before.

        1. 6

          Wow you weren’t kidding, it is. Ironically it’s actually not the entire html body, it’s everything on the page after the main title. Weird.

          Looking at the markdown page layout file in the repo, it looks like the committer thinks that you yield a variable, using a hash literal to provide a default. But according to the Middleman docs on front matter variables, you don’t do that, you use the current_page.data object. Amusingly the docs even use current_page.data.title as an example.

          Edit: I made a merge request.

        1. 8

          Things like this are why I laugh whenever people claim javascript is “taking over”.

          Even fucking php has const’s that are actually constant.

          1. 3

            Honestly the only people that believe JavaScript is taking over are people who haven’t used anything else.

            1. 2

              And yet it’s everywhere. If any language is really “taking over”, it’s JS. It’s mandatory in the browser, and it’s optional almost everywhere else.

              1. 1

                That’s why it’s so big. If you want to learn only one language it has to be JS.

                1. 1

                  You think javascript is mandatory to make a website or web app?

              2. 2

                But this feature (preventing mutation of mutable structures recursively) is uncommon. So far I’ve seen it only in PHP and Rust. What other languages has it too?

                1. 3

                  recursive mutation is not even the issue, const in JavaScript just means “I will not reassign this reference” so even the top-level value is mutable. You can const a=[]; a.push({});

                  1. 1

                    If top-level mutation prevention can be implemented, then all levels down is not that hard, I think. But I can’t imagine how to do it in languages with pass-everything-by-reference semantics, and most languages have such semantics (js, java, python, ruby, etc).

                    Some of such languages has “constant binding” feature too, i.e. java’s final, which lots of users find useless, and still I see lots of final in java code. Clojure has let which is similar to having only const in js, and it also can’t prevent mutation of underlying objects:

                    => (let [a (java.util.LinkedList.)] (.add a "foo") a)
                    ("foo")
                    

                    So while mutation by calling methods can’t be prevented at all in js, and it’s not surprising behavior, mutation of captured var bindings can be prevented and I think it’s useful. Lots of gotchas in js happen when closures accidentally mutate captured vars (or when captured environment mutate them).

                    Languages with multiple passing semantics such as PHP, which have by-value and by-reference passed function args, or Rust which have & and &mut, can have mutation prevention. In Rust you can see if object method does not mutate object if it has &self and not &mut self, for example. BTW, I written lots of PHP code and still don’t understand its semantics, it’s feels on the same level of complexity as Rust.

                  2. 1

                    Its not so much about whether you can have an immutable structure, it’s whether you think you can.

                    Before PHP’s const or define() supported e.g. constant arrays, you couldn’t assign them - it would error at compile time (which is effectively runtime for php).

                  3. 1

                    It’s not uncommon for things with undesirable qualities to emerge as the dominant entity in their domain. The flaws of JavaScript should not be assumed to correlate with its rate of adoption, whether or not they should.

                    1. 0

                      Do you laugh because despite all of this Javascript is arguably actuslly taking over (for whatever that means), while PHP, with its real consts, is slowly fading away?

                      1. -1

                        would this be the same javascript community that was just recently ass fucked in public because they needed a third party module to pad strings, or the one that needed a third party module to determine if a number is even?

                        I use php but I’m not attached to it. I also write shell regularly and I’ve used some Lua, a bit of java even. I’d like to try D soon.

                        Even then I’ll use php or shell or lua or whatever where it’s appropriate.

                        The javascript community has no such concept. That’s why you end up with ridiculous nodejs “alternatives” for things that could be achieved out of the box with a little shell on most *nix systems.

                    1. 1

                      Don’t know what to think. Flogging a dead horse or resurrecting a dead horse

                      1. 9

                        Definitely necrhorsemancy

                        1. 2

                          Equinecromancy? Perhaps?

                        2. 4

                          Resurrecting a horse corpse so it can then be flogged?

                        1. 1

                          Yeah, this is cool and all. Just don’t forget that one of Microsoft’s tried and true tactics is Embrace, Extend, and Extinguish. They’re currently embracing (“we <3 Linux”) and extending (WSL).