1.  

    Here are some other useful examples. First, you can Unmarshal directly into a map:

    a1 := []byte(`{"sun": 10, "mon": 11}`)
    var m1 map[string]int
    json.Unmarshal(a1, &m1)
    

    Second, you dont have to create one time use structs, you can just use struct by value:

    a1 := []byte(`{"sun": 10, "mon": 11}`)
    var m1 struct{Sun, Mon int}
    json.Unmarshal(a1, &m1)
    

    Finally, if some values are known and others unknown, or of possibly different types, you can specify that in the struct:

    a1 := []byte(`{"sun": 10, "mon": "eleven"}`)
    var m1 struct{
       Sun int
       Mon interface{}
    }
    json.Unmarshal(a1, &m1)
    

    https://cup.github.io/autumn/json-string-to-map

    1. 1

      Warning, site has a user hostile “accept only” cookie policy

      1. 8

        Gawk has all of these. Don’t port anything.

        At some point, however, awk’s limitations start to show. It has no real concept of breaking files into modules, it lacks quality error reporting, and it’s missing other things that are now considered fundamentals of how a language works.

        1. 3

          GAWK is not portable. You could possibly say “neither is Python”, but I would bet that Python is more available than GAWK. and even if it isnt, if youre going to have to install a package anyway, wouldnt a butcher knife be better than a plastic kids knife?

          I like AWK, I have used it for many years and would consider myself an AWK expert. But when the question is “what is the right tool for the job”? The answer is rarely AWK or GAWK.

          1. 9

            The right tool is obviously Perl in this case.

            1. 6

              and the tool is a2p since forever.

            2. 6

              What do you mean “gawk is not portable”? Name one platform that has awk and python that does not have gawk?

              The point is you can either spend your time rewriting or you can just keep using the same code with extensions.

              And if you really really want to rewrite, Perl is a lot closer. This whole article just seems like someone who has arbitrarily decided that python is a “real” language so it’s inherently better to use it.

              1. 8

                The author blurp has:

                He has been programming Python since 1999

                Looks like a case of hammer, nail to me.

                (and the examples with the yields only convince me more that python is not the better choice)

                1.  

                  To be fair, I know far more carpenters with Python hammers than with Awk hammers.

                  I myself have but a ball peen Awk hammer, compared to my sledge Python hammer. So for really stubborn nails, Python is the better choice for me.

                2. 0

                  Um, Debian, BSD? should I go on?

                  1. 3

                    I suppose you mean that gawk features are not portable among the default awk on different OSes, so you shouldn’t use them and pretend that the script will work on any awk. That is totally true.

                    But the OP likely means that you can use gawk explicitly, treating it as a separate language. Gawk is available on almost all Unix OSes, so it is portable.

                    1. 2

                      My point is if your going to have to install a package, you might as well install $proper_programming_language instead of AWK. Unless what you need can be easily done with GAWK alone, its not really worth using.

                      Keep in mind that even with GAWK, proper support for indexed arrays is not available, nor first class functions, private variables in AWK are footguns, no HTTP client, no JSON, etc.

            1. 4

              People (Mozilla devs and r/Firefox) criticise me for disabling updates, “you shouldn’t do that”, “why do you need to do that”. This is why.

              I am an adult, and a computer programmer. I am perfectly capable of weighing the pros and cons of automatic updates. And I will tell you, for me, after doing this for 15 years, automatic updates just aren’t worth it. They cause more problems than they solve. When a new release comes out, I look at the notes and decide if I need it or want it. I am in control. My browser is not a playground for Google devs or anyone else to mess with. I use it for work, and I’m not going to let them screw that up.

              Can you even disable updates on chrome?

              1. 1

                I was hoping to see the Gates one for MovieMaker - was not disappointed :)

                1. 2
                  • Ctrl-Click on Windows/Linux
                  • Cmd-Click on macOS
                  • Middle click everywhere I know about

                  All of the above will do what you expect.

                  1. 2

                    Middle click works on Windows…

                    1. 2

                      On macOS also.

                    2. 1

                      The point I wanted to make with this is that the way I expected it to work is that clicking on a link would open it in a new window.
                      This tampermonkey script solves that problem and makes the page work how I would expect it to work as an aggregator of links rather than as a waypost to other sites.
                      By opening things in a new tab I am not loosing track of where I was and I won’t lose the tab after I close the article or comments.
                      Besides, all the examples you list will open the link in the background in a new tab. This will create a new tab and switch to that tab. The functionality is not identical.

                      1. 1

                        It might be the way you expect it to work, and that is totally fine. This is however extremely subjective, and making this the default will ALWAYS open as a new window, and there won’t be any way to follow a link directly, while the current behavior gives you the choice (left click vs. middle click).

                        1. 1

                          You are correct. That is why this is implemented using a Tampermonkey script. That way I can have my preferences without it affecting your preferences.
                          I suggest you not install this Tampermonkey script if you don’t want it to work the way I do.

                    1. 51

                      Upvoted not because I think this is a good idea, but because I’m curious to get others’ opinions on it.

                      This seems like a terrible, terrible idea. It’s yet another way of soft-forcing Google’s hegemony on the Web. Specifically:

                      Badging is intended to identify when sites are authored in a way that makes them slow generally

                      I’m pretty sure this actually means “badging is intended to identify when sites are authored in a way that makes them slow on Chrome…”

                      And this isn’t like flagging a site that has an expired certificate or something. That is a legitimate security concern. This is making a value judgement on the content of the site itself, and making it seem like there’s something fundamentally wrong with the site if Google doesn’t like it.

                      Nope.

                      1. 21

                        I’m with you.

                        when sites are authored in a way that makes them slow on Chrome

                        And further, “badging is intended to identify when sites are authored without using AMP” - or whatever else Google tries to force people into using.

                        Seems like yet another way for Google to pretend to care whilst pushing their own agenda.

                        1. 9

                          They refer to two tools, one a Chrome extension (Lighthouse) that I didn’t bother to install, the other a website (PageSpeed Insights). I went for the latter to test a page that has no AMP or other “Google friendly” fluff and is otherwise quite light weight (https://www.coreboot.org) and got a few recommendations on what to improve: Compress some assets, set up caching policies and defer some javascript.

                          If that’s all they want, that seems fair to me.

                          (Disclosure: I work on Chrome OS firmware, but I have no insights in what the browser level folks are doing)

                          1. 4

                            Yeah, within 2 seconds of loading this link I was worried they were just pushing AMP. If they really are just pushing best practices then I’m cautiously optimistic about this change, and the fact that they didn’t mention AMP and instead linked to those tools gives me hope… but it’s Google, so who knows.

                            1. 10

                              I’m definitely still wary. I personally feel that Google sticking badges on websites they approve of is never going to end well, regardless of how scientific it may seem at the beginning.

                              I really feel like there are major parallels to be drawn between Google and the rules of Animal Farm.

                            2. 3

                              But that’s not all they want. Google and Chrome are now positioning themselves to visually tell users whether or not a site is “slow” (according to whatever metrics Google wants, which can of course change over time). As with most Google things, it will probably look reasonable on the surface, but long term just result in Google having even more control over websites and what they can and can’t do.

                              I would agree with you if it weren’t for Google’s long history of questionable decisions and abuses of their position as the (effective) gate keeper of the web,

                            3. 2

                              whatever else Google tries to force people into using.

                              QUIC?

                              1. 3

                                Not to mention that and SPDY being the basis of the “next” versions of HTTP (HTTP/2 and HTTP/3) which will no doubt be rabidly pushed for.

                                1. 2

                                  Are there technical problems with HTTP/{2,3} or are you just worried because Google created them?

                                  1. 1

                                    Specifically the fact Google created them. As tinfoil-rambling as it sounds, they already deal out a rather extensive spying/targeted advertising network, a possibly-manipulable gateway to information, the most popular video service, the most popular browser, some rather popular programming languages (Go, Dart), power a large portion of Web services (Chrome’s V8 in Node.js, that and Blink for Electron), many alternative browsers being Chromium/Blink-based, the AMP kerfuffle, ReCAPTCHA, and maybe the future protocols as to how their vision of the Web works.

                                    They keep encompassing more and more parts of the Web, both technical and nontechnical, and people keep guzzling that down like the newest Slurm flavor. That’s what worries me the most.

                                    1. 2

                                      people keep guzzling that down like the newest Slurm

                                      http/2 and http/3 are the result of a multi-party standardization process. It’s not SPDY with just a new label.

                                2. 1

                                  Yes.

                              2. 7

                                Generally I’m against prejudging companies like this, but Google has earned it, and then some.

                                Some sites that I use have Recaptcha. I use Firefox, and I can only pass the captcha if I log into Gmail first. Honestly, what kind of Orwellian horseshit is that?

                                1. 3

                                  So, I can at least comprehend this one, even if I hate it.

                                  The whole point of recaptcha is to make it hard to pass unless you can prove you’re a real person. Being logged in to a google account which is actively used for ‘real things’ (and does not attempt too many captchas) is a really hard-to-forge signal.

                                2. 1

                                  What’s an example of a site that loads fast in Chrome but slowly in Firefox?

                                  1. 8

                                    Well, given what’s happening here…any site Google decides.

                                    To be less pithy: this could be used as an embrace-extend-extinguish cycle. Sure, right now it’s all just general best-practices but what if later it’s “well, this site isn’t as fast as it could be because it’s not using Google’s extensions that only work in Chrome that would make it 0.49% faster, so we’ll flag it.”

                                    I’m not saying Google is definitely going to do that, but…I don’t like them making this sort of determination for me.

                                    It gives soft pressure to conform to Google’s “standards” whatever they may be. No website is going to want to have a big popup before it loads saying “This site is slow!” so they’ll do whatever it takes to have that not happen, including neglecting support for non-Chrome browsers.

                                    1. 4

                                      I don’t know if it’s still the case, but at one point YouTube deployed a site redesign that was based on a draft standard that Chrome implemented and Firefox did not (Firefox only supported the final, approved standard). As a result, the page loaded quickly in Chrome, but on Firefox it downloaded an additional JS polyfill, making the page noticeably slower to render.

                                      1. 1

                                        How about Slack video calls? Those are a “loads never” in my book. (Still annoyed about that.)

                                    1. 4

                                      Is this a common use of the word “manifesto”? Or am I right to think it should not be tolerated?

                                      1. 22

                                        Or am I right to think it should not be tolerated?

                                        You seem to have strong opinions on this topic. Perhaps you should release a document describing your reasoning and the rules you propose for future usage of the word. ;)

                                        1. 9

                                          “How to Write a Manifesto: A Manifesto”.

                                          1. 1

                                            If I did maybe I would

                                          2. 10

                                            I think this is something the Swift community does for large overarching proposals. There are several other manifestos in the docs: ABI Stability Manifesto, Generics Manifesto, Ownership Manifesto, String Manifesto.

                                            1. 8

                                              Gah that makes me cringe.

                                            2. 6

                                              Wikipedia sez:

                                              A manifesto is a published declaration of the intentions, motives, or views of the issuer, be it an individual, group, political party or government.

                                              1. 3

                                                Yeah I don’t get it (nor the point of the software itself tbh), isn’t this just a language extension / library proposal?

                                                1. 3

                                                  Is this a discussion to have here, where we can do nothing about it, or as an issue in the repository, where:

                                                  1. The people arguably most familiar with the process of doing things in Swift will respond
                                                  2. The people arguable most likely to be able to initiate some change in Swift will (hopefully) listen
                                                  3. We don’t end up with 13 of the 14 comments in this thread being about the least interesting part of this submission; a single word in the title.
                                                  1. 1

                                                    My two cents, a 15th commentary ill at ease with this word:

                                                    Personally, and maybe for the other 13/14 who comments you talk about, the word Manifesto was entry point for reading the article.

                                                    The 3 Manifestos I know of in programming are:

                                                    • The Agile Manifesto
                                                    • The Software Crafsmanship Manifesto
                                                    • The Test Driven Development Manifesto (not sure it’s been published though, it was written in a SoCraTes UK conference)

                                                    The 4th Manifesto I know of, is the Manifesto of the Communist Party written by Marx and Engels in the years 1850’s I think. There are probably numerous other Manifesto I don’t know of.

                                                    Contrarily to your opinion about the “least interesting point”, I think that the philosophical content of those Manifesto is their “Raison d’Etre”, the reason why they are Manifestos and why they are refered as such. (Whether we agree or not on the content).

                                                    The fact there already exists a library in Haskell (as puffnfesh noticed) that does that kind of stuff, and that there is no mention about it in the Differentiable Manifesto is also to be noticed.

                                                    One of the other comments says that it’s a habit in the swift community to call important stuffs Manifesto… So…

                                                    1. 1

                                                      The question I raised was whether this is a nonstandard and misleading usage of the word from the standpoint of the wider software community, so I believe it is a discussion to have here.

                                                      If someone with a GitHub account feels there is a consensus that this usage of “manifesto” is wrong, and cares enough about the Swift community to raise the issue with them, they can certainly do that.

                                                      1. 2

                                                        That’s closer to what I think of as a manifesto, but this Swift proposal is not the same type of thing.

                                                      2. 2

                                                        Or am I right to think it should not be tolerated?

                                                        … as in you’d resist or otherwise fight against it? Are you a prescriptivist?

                                                        1. 2

                                                          Is it prescriptive to want people to use language which is not misleading?

                                                          1. 1

                                                            Were you mislead?

                                                            1. 1

                                                              Yup

                                                        2. 1

                                                          It makes me think of this, so to me it’s a weird use of the word as well.

                                                          1. 23

                                                            I am against because: 4 of the 6 links you posted are from the creator. If we award tags from that behavior it sets a bad precedent.

                                                            I am for because: It would allow me to filter Zig out.

                                                            1. 19

                                                              I don’t think you want to filter Zig out, since you seem to post in every zig-related submission.

                                                            1. 15

                                                              The Zig gmp versions call C code, and are no longer really “Zig”, or a fair comparison to the Go code. You can use cgo to do the same with Go for an equal comparison.

                                                              1. 7

                                                                It looks like for the direct Zig vs Go comparisons, Go clearly wins. Now in full generosity to the author it appears they were trying to show how GMP versions are fast, but it’s unclear why that should be notable here.

                                                                Compilation
                                                                fact-linear.go - 0.11 seconds
                                                                fact-linear.zig - 0.51 seconds
                                                                
                                                                fact-channel.go - 0.10 seconds
                                                                fact-channel.zig - 1.0 seconds
                                                                
                                                                Performance
                                                                fact-linear.go - 19.86 seconds
                                                                fact-linear.zig - 46.43 seconds
                                                                
                                                                fact-channel.go - 20.2 seconds
                                                                fact-channel.zig - 23.6 seconds
                                                                
                                                                1. 6

                                                                  it’s unclear why that should be notable here.

                                                                  Quoting the article:

                                                                  The most important thing to note here is that the fastest performance was a single-threaded implementation that linked gmp, which has high performance big-integer multiplication.

                                                                  So including gmp was a smart decision by Brendon to point out that hey, big caveat in this example, the bottleneck is large integer multiplication, and both Go and Zig’s std lib big ints are not even close to gmp’s performance.

                                                                  Which is why I’m trying to draw attention to the actual thing I’m trying to post about which is the fact-await.zig example demonstrating the same code working with evented I/O enabled and disabled. I think the significance of this has still not quite sunk in.

                                                                  1. 11

                                                                    I think perhaps you might want to reword your article some to include some of these ideas a little more explicitly and perhaps redundantly, also earlier on in the article. If you wish to share effectively what you have done here, you have to word it in such a way that it gets received in the way that you expect. Test it out on some readers you can trust to be honest and direct. If you were trying to communicate that the bottleneck for both languages is a large integer multiplication that’s a fine and acceptable thing to say, but that wasn’t clear to me the reader. Certainly at a glance you can concede that it appears as though you’re comparing Go to Zig with GMP, as though Go can’t use GMP even though it can 1 .

                                                                    [1] https://github.com/ncw/gmp

                                                                2. 5

                                                                  GMP versions are clearly marked GMP and I don’t see anything unfair. I think if you send PR to add cgo/GMP version it will be accepted.

                                                                  1. 19

                                                                    Just the three letters “gmp” don’t mean much; I had to look at the Zig source code to see it’s just calling C code; it could be a Zig library, for example. Right now someone looking at the overview will go away with the impression that Zig is significantly faster than Go, which is simply not the case.

                                                                    I think if you send PR to add cgo/GMP version it will be accepted.

                                                                    Probably, but I don’t think it’s my job to correct misleading benchmarks on the internet, and I don’t think that “send a PR” is a constructive reply to this kind of feedback.

                                                                    1. 3

                                                                      The article links to gmplib.org… You had to look at the Zig source code, but you could also have been an attentive reader. I tend to agree that the article could have been even more clear, and wording improvement also will be accepted with gratitude.

                                                                      I don’t think that “send a PR” is a constructive reply to this kind of feedback.

                                                                      Your “cgo” comment was clearly a feature request and not a bug report, and I believe “send a PR” is appropriate.

                                                                      1. 13

                                                                        I don’t know why you’re being so defensive; comparing a program with embed C versus one that doesn’t is clearly comparing apples to oranges. That it favours the language the author is trying to promote is not a good look, to say the least.

                                                                        If you need to carefully read everything, follow links, and have knowledge of what certain three-letter acronyms are, then you’re just being misleading. It’s no different than starting a chart at non-0 to exaggerate trends, for example. Sure, the information is in there, but also easy to miss. Any casual reader – which are most readers – will take away that Zig is faster than Go, which is not demonstrated by this particular benchmark. This is rather interesting as the Zig’s homepage claims that “Zig is faster than C”.

                                                                1. 5

                                                                  Adopting the Contributor Covenant

                                                                  I am not too happy about this. I believe that all users should be treated equally, but something about these recent CoC changes just destroys communities:

                                                                  https://meta.stackexchange.com/questions/334248/an-update-to-our-community

                                                                  Off topic, I see that you are the author of the linked post. I also see that you have more posts than comments:

                                                                  https://lobste.rs/u/ttaylorr

                                                                  Is it your intention to just use this platform to advertise for GitHub?

                                                                  1. 17

                                                                    I think codes of conduct are good. They’re important for making community norms explicit, and as tools to change community norms that are inappropriate. Both of these are important for marginalized members of the community.

                                                                    Something important to remember is the paradox of tolerance. If you’re willing to tolerate the intolerant, the intolerant will eventually turn the community into an intolerant community.

                                                                    The code of conduct that git has adopted is a pretty relaxed one. As long as you’re not a jerk you won’t even have to think about it.

                                                                    1. 10

                                                                      I’m not a CoC-fan either (though primarily because it implicates corporate professionalism (ala anti hacker culture) than freedom of speech issues), but I still wonder. What examples are there the “Contributor Covenant” in practice. When has it helped in ways that a simple “be kind and respectful” wouldn’t have?

                                                                      Also don’t forget that it’s this specific document that’s far more controversial than any self-written community guidelines or mailing list rules. I for example still don’t understand what’s so great about it specifically. You say it makes community norms explicit, but most of the time, it’s just a copy-pasted document from outside said community.

                                                                      1. 4

                                                                        While I think that code of conducts are probably a good thing, I don’t share your optimism about the Contributor Covenant.

                                                                        I admit I haven’t read the CC closely since a very early version[0], but what I remember of it was quite vague (perhaps this is what you mean by “relaxed”?). Moreover, its focus on “professionalism” thoroughly undermines its goals of inclusion, and (for people whom that isn’t reason enough) is counter to the hacker ethos.

                                                                        If you’re looking for a code of conduct similar to the CC, better (not perfect IMO, but much better!) examples include the Slack, Rust, and Django CoCs.

                                                                        [0]: which I really wanted to like, up until I suggested a minor clarification to the text and then was … promptly blocked by the author.

                                                                        [1]: Note: a one- or two- page CoC isn’t nearly enough space to make community norms explicit to the point where every decision to fire or censure a moderator won’t devolve into a flamewar (worse yet, it may invite exegesis). For comparison, the IWW—which wikipedia describes as an anarchist organization—has a process document that is about about 100 pages long. A CoC is not a process document.

                                                                        1. 2

                                                                          Thanks for the link regarding the use of the word “professionalism”. I’d like to note that the term is last in a list of stuff that’s example of what not to do, so it’s not front and foremost in the main text.

                                                                          I’d also like to note that the term “hacker ethos” is similarly coded, as “hacker culture” is historically coded male and privileged. If there are attempts to reclaim the term, I’d love to have some more information to read about that.

                                                                          I do agree that the CC is maybe a bit too brief, and not enough to prevent acrimonious rules-lawyering.

                                                                          1. 4

                                                                            “hacker culture” is historically coded […] privileged

                                                                            Is it? Before these excessive amounts of money poured into tech in the late 90s, being part of hacker culture implied a certain danger in general society, socially but also physically.

                                                                            (no argument on it historically being a male domain)

                                                                            1. 2

                                                                              Re: the term “privileged” - up until the late 90s, just accessing a piece of computing machinery implied access to quite a bit of disposable income. I realize the word has more connotations than just material wealth, but it’s certainly a big part of it.

                                                                              1. 5

                                                                                I grew up in a western “working poor” situation and got my home computer in 1990. It was horribly outdated by that point, but computing access was one of these situations where “trickle down” actually worked because those with the money had lots of motivation to go with the latest and greatest and got to get rid of their stuff from last year. Two or three iterations later it became affordable for those who didn’t really have the money but the interest in pursuing the topic.

                                                                                Sure, somewhere in the poorer parts of Africa or Asia widespread access to computing is still not a given today (although smartphones are making inroads), but that’s generally not what the people mean when designating others as “privileged”.

                                                                                1. 4

                                                                                  Stepping back from a particular time period, “hacker culture” has a long history, and that history is mostly students at prestigious universities and colleges (MIT, Stanford). Now, not all of these students were personally affluent, but by attending these seats of learning they were privileged.

                                                                                  In the aggregate, it was easier to get involved in computing and hacking if you were part of an affluent milieu, or if you were not, was encouraged to study - and more importantly, had the opportunity to study, instead of for example, working for a living. Both contexts imply disposable “income” - either in money, or in the acceptance of opportunity cost in preparing a young person for higher education.

                                                                                  1. 3

                                                                                    Both contexts imply disposable “income” - either in money, or in the acceptance of opportunity cost in preparing a young person for higher education.

                                                                                    So Europeans (no matter their intersectionality in other aspects) are off the scale thanks to access to higher education being taken care of, for the most part.

                                                                                    If we collect some more of these properties that cover entire continents, everybody is privileged, rendering the term meaningless.

                                                                                    1. 4

                                                                                      Higher education in much of Europe may be gratis in regards to attendance fees, etc, but there are not enough places for everyone who wishes to attend them. So you still have a situation where more well-to-do are able to prepare their offspring for the competition of attending by extra study time, language study abroad, etc etc.

                                                                                      Anyway, I don’t think it’s productive to continue this discussion. We obviously have different meanings of the word “privileged”, and that’s where the rub lies. Thanks for taking the time to respond.

                                                                            2. 2

                                                                              I’d also like to note that the term “hacker ethos” is similarly coded, as “hacker culture” is historically coded male and privileged.

                                                                              Male yes, but I think irrelevant. Privileged, no.

                                                                              It’s pretty tough to pin down a strict definition of “hacker ethos.” To me it means tinkering with computers and soaking in the culture of bbs and meetups and reading through books like Steven Levy’s Hackers [0] and stacks of 2600.

                                                                              But I’m fairly young and there are many different experiences.

                                                                              Historically, and currently, the vast majority has been written by males but I think the hacker ethos is not exclusive to non-males and the difference is around curiosity and knowledge sharing over anything gender-specific.

                                                                              Note that I think it includes many characteristics of culture that aren’t specific to hacking.

                                                                              But I don’t think the hacker ethos is privileged at all. It’s focus on low resource environments and DIY and sharing is as close to anti-privileged as you can get.

                                                                              My own first experiences with computers was through a public school and library and I didn’t have access to computing resources for many years. MIT hackers were great, but they aren’t everyone. Visiting hackers in many countries shows similar tinkerers and low/zero resource learning systems. It was really neat meeting hackers in Kampala who grew up programming on raspberry pis, getting electricity through creative means because their home didn’t have the electricity grid.

                                                                              So while there were certainly hackers with lots of resources, there were (and still are) many without privilege.

                                                                              [0] https://en.wikipedia.org/wiki/Hackers:_Heroes_of_the_Computer_Revolution

                                                                          2. 3

                                                                            Codes of conduct should only be needed if and when bad conduct repeatedly and systematically occurs. I have never come across any such bad conduct in my many years of working on free software so I can only assume it is not wide-spread. It would be enlightening to see some examples of the bad conduct which led the Git project into adopting this code. If there are none they’re on thin ice in adopting it as far as I’m concerned, especially since these codes themselves often lead to strife.

                                                                            1. 6

                                                                              Codes of conduct should only be needed if and when bad conduct repeatedly and systematically occurs

                                                                              By that time it’s too late, the damage is done.

                                                                              Much like political constitutions, it’s best to get these things in place before things get bad, and when everyone is on the same page.

                                                                              1. 10

                                                                                It’s possible that the way that you experience the world is not the way that marginalized people experience the world. And maybe we should be focusing on making it easier for them to contribute, rather than the people who are least marginalized.

                                                                                Git is part of the larger open source community, and part of the larger computer science community, both of which have had many problems over the years. You can find many examples of this if you google “open source sexual harassment”. Linus Torvalds, who started the Git project, is famous for his abusive rants. When we’ve seen so many examples of fires breaking out in other similar projects, it seems sensible to get a fire extinguisher.

                                                                                1. 13

                                                                                  Linus Torvalds, who started the Git project, is famous for his abusive rants

                                                                                  His rants were abusive in the regard of someone who he considered “dumb” at the time, or similar. To my knowledge he wasnt ranting at someone because of their race or gender identity. Do you have evidence to the contrary? Else it comes off as you slandering him, which I wont stand for.

                                                                                  1. 6

                                                                                    It’s possible that the way that you experience the world is not the way that marginalized people experience the world

                                                                                    I’m not sure it’s wise to tell random folks you likely never met (or in case of standardized documents: whole communities) that they’re not marginalized as if speaking from authority.

                                                                                    1. 2

                                                                                      Linus Torvalds, who started the Git project, is famous for his abusive rants.

                                                                                      I love Linus “rants” and they are not abusive, they just use colorful language, which is refreshing.

                                                                                      You can only interpret these texts as abusive if you are less than 12 years old.

                                                                                      1. 10

                                                                                        (the twitter link leads to a post in which SS calls Ted Tso a ‘rape apologist’)

                                                                                        Please note, I am not diminishing what rape is, and or any particular person’s experience. However, I am challenging the use of statistics that may be hyperbolic and misleading … – Ted Tso

                                                                                        That Ted Tso?

                                                                                        Throwing epithets does not a truth make. In this case Tso was called a ‘rape apologist’ but that does not make him one, it only means someone attached a label to him because he dared to disagree. Disagreement is not the same as bad conduct. Sometimes it can be solved by discussion, sometimes there is no solution other than acceptance of the fact that people disagree. Let it be, let them be, they have the same right to an opinion as you have.

                                                                                        (to make it clear, I realise that cup posted this link as an example of how these policies lead to strife)

                                                                                        1. 10

                                                                                          Remember the Halloween documents [1], Microsoft’s infamous plan to derail free software in general and Linux in particular? Just image what they would have been able to achieve by strategically calling out developers as ‘rape apologists’ and such.

                                                                                          Maybe someone did realise this after all? Identity politics is a potentially devastating way to break up communities, and many of these ‘codes of conduct’ can be traced back to this type of politics.

                                                                                          [1] https://en.wikipedia.org/wiki/Halloween_documents

                                                                                    2. 4

                                                                                      I am not too happy about this. I believe that all users should be treated equally, but something about these recent CoC changes just destroys communities:

                                                                                      I’m actually rather surprised that it all happened so quietly. I guess it was overshadowed by the RMS-situation.

                                                                                      1. 8

                                                                                        Me neither, identity politics - the basis of the contributor covenant - has no place in free software communities - or any other community for that matter. It only serves to create factions where none should be, it raises (often trivial) differences between individuals to their defining characteristics and uses those to split communities into groups, groups into hierarchies of oppressed and oppressors. To what purpose, other than to create strife? It is totally antithetical to the famous New Yorker cartoon of the dog-with-a-keyboard telling the world that “on the internet, nobody knows you’re a dog” [1].

                                                                                        Sendmail was written is and maintained by Eric Allman who was and is openly gay. He’s married to Marshal McKusick of BSD fame. Nobody cared. Nobody cares. That is how it should be and how it was, but that is not how it will be if identity politics really takes hold because Allman will find himself pushed into a certain slot (white [-10] middle-aged [-6] gay [+7] man [-10]) instead of just being known as ‘the guy who developed Sendmail’. Same for McKusick, Same for, well, everyone else.

                                                                                        The History [2] and Talk [3] section on the Contributor Covenant article [4] on Wikipedia is telling in this respect: criticism is silenced with a claims of ‘The situation is completely solved.There is no need for this outdated section’.

                                                                                        [1] https://en.wikipedia.org/wiki/On_the_Internet,_nobody_knows_you%27re_a_dog

                                                                                        [2] https://en.wikipedia.org/wiki/Contributor_Covenant

                                                                                        [3] https://en.wikipedia.org/wiki/Talk:Contributor_Covenant

                                                                                        [4] https://en.wikipedia.org/w/index.php?title=Contributor_Covenant&action=history

                                                                                        1. 3

                                                                                          New contributors can be assured that the Git community is behind this adoption with the introduction of the Code of Conduct, Acked-by 16 prominent members of the Git community.

                                                                                          … out of 1316 contributors currently listed on https://github.com/git/git.

                                                                                          1. 1

                                                                                            Thanks. I was trying to learn what such a vague statement meant.

                                                                                          2. 3

                                                                                            I also see that you have more posts than comments […] Is it your intention to just use this platform to advertise for GitHub?

                                                                                            All five posts are “Git highlights” blog posts. Nothing is specific to GitHub, other than their being hosted on GitHub’s blog.

                                                                                          1. 12

                                                                                            NO tags, categories, taxonomy

                                                                                            I get that maybe you dont like Hugo because it has too many features. In general I prefer smaller faster software, many times at the expense of features.

                                                                                            But to me taxonomy is essential, its the killer feature, its what separates a real “SSG” from the others. Jekyll lack of taxonomy is literally the one reason I stopped using Jekyll:

                                                                                            https://github.com/jekyll/jekyll/issues/6952

                                                                                            It was a pain to switch to Hugo, but that one feature made it worth it. Before, I would spend so much time deciding on a category for each post. Since the categories were assigned via folders, you could only choose one category per post. Now with Hugo, I can put one, two or how many I want categories on each post.

                                                                                            1. 7

                                                                                              In soupault, I went for allowing the user to extract and export any metadata from pages to JSON and make their own taxonomies from it (like microformats). But, the reason it needs no front matter is that it can look inside HTML.

                                                                                              If “no front matter” is a hard design goal, it may be tricky to apply that idea to underblog. But, maybe there are other “natural” metadata sources one can use instead? Random idea: put a page in a subdirectory to set its category, and symlink it to other subdirectories to add secondary categories.

                                                                                              In any case, the great thing about SSGs compared to server-side web software is that you can safely use an unmaintained SSG. Their proliferation is not harmful and stopping updating/developing further is not an irresponsible act. If for some people underblog’s feature set and workflow is exactly what they want, nothing wrong with it.

                                                                                              1. 1

                                                                                                Random idea: put a page in a subdirectory to set its category, and symlink it to other subdirectories to add secondary categories.

                                                                                                This is interesting, thank you. I do believe this sort of thing fits nicely with the underlying philosophy, because it introduces no additional complexity and is absolutely transparent. Love it. Added an issue to discuss with other contributors.

                                                                                                Thank you!

                                                                                                1. 1

                                                                                                  Good luck getting that working on Windows…

                                                                                              2. 3

                                                                                                I understand, taxonomy is essential to me too, in many cases. That’s why I’m using Hugo on three different projects.

                                                                                                But every once in a while I need to make a small blog. Or recommend a simple way to generate a blog from Markdown. And I can’t really recommend neither Jekyll nor Hugo when the person wants to basically make a site out of a bunch of md files. I don’t want to dump config files, front matter, layouts/themes and plugins/dependencies on them. At that point, I’d rather recommend them to try Ghost or something.

                                                                                                The goal of underblog is to provide a way to do it without learning anything new. No new concepts, no multi-layered processing, etc.

                                                                                                So, while taxonomy is essential for many projects, the mental and technical overhead of Hugo/Jekyll is also a thing to consider. Underblog is not an alternative to Jekyll or Hugo, as much as a bicycle is not an alternative to a container ship.

                                                                                                1. 1

                                                                                                  Re Underblog. Love the name. :)

                                                                                                  1. 2

                                                                                                    Thanks :) My first idea was “shyblog”.

                                                                                                2. 2

                                                                                                  Time to plug my static site generator :) https://github.com/xiaq/genblog

                                                                                                  It is also in the realm of minimalist static site generator, but it generates an index page for each category. Besides this, there are 2 other differences with the tool in the post:

                                                                                                  • It does not auto discover posts, but always relies on an index.toml file, which is a “manifest” of everything. This is perhaps similar to many established generators, but it goes to the extreme of not assuming any filename (other than index.toml) and require every filename to be specified in index.toml.

                                                                                                  • It does not compile Markdown; rather, it expects each post to be HTML fragments and merely inserts them verbatim into the template. You are free to use whichever Markdown compiler you like. I am not aware of any established generators that does this; and IMO it is the correct design choice to decouple from Markdown compilation.

                                                                                                  I haven’t written any doc for this tool yet, but if you are interested, take a look at https://github.com/elves/elvish/tree/master/_website, starting with Makefile (which does the Markdown compilation using a combination of pandoc and some adhoc macro stuff) and index.toml (the manifest file).

                                                                                                  1. 1

                                                                                                    Huh, I have tags and categories on my Jekyll blog. Although the tags I guess I wrote custom plugins for, ..and I also wrote a custom Generator for the category pages .. and I use jekyll-pagination. 😅 Jekyll is a bit more like Jenkins; it comes with little in core and you need plugins to make it really do anything. I don’t really have a problem with that architecture honestly.

                                                                                                    To be fair to the author, it looks like this is a little experiment to get a custom generator up for some personal or professional site. Going back, I really wish I had written my own instead of using Jekyll. It gave me some things out of the box or with plugins, but I was wrestling a lot with it .. and liquid templates are garbage!

                                                                                                    If this is a small personal project, I’m sure it will grow to gradually fulfill the author’s needs.

                                                                                                    1. 0

                                                                                                      This is pretty much what I wanted to say. Jekyll is minimalist, but, it’s Ruby, and easy enough to extend.

                                                                                                      For categories I’ve been using this plugin0, last updated in 2012 but still works. It generates a page for each category. I also have a page with some Liquid I wrote that lists every category1.

                                                                                                  1. 4

                                                                                                    Sorry for being dense, but I read the whole article and still dont get it. Are you using pkg just to stop the nagging, or actually another reason?

                                                                                                    1. 2

                                                                                                      With that said: I’ve begun using pkg. pkg is consistent with cmd and internal and other non-package directories. You know what packages contain Go code and which don’t. You structure your project without making all your packages internal.

                                                                                                      In other words; to add structure to your projects without making all your packages internal/private, make the layout of your packages consistent when you use the cmd directory or have other non-package directories at your project’s root, stopping the nagging is a bonus.

                                                                                                      1. 2

                                                                                                        And what are the downsides of using pkg? That wasn’t totally clear to me either even after reading the article.

                                                                                                        Just that they’re “empty” and don’t serve any compiler or naming related purpose? Is that the only complaint or is there another one I missed?

                                                                                                        1. 2

                                                                                                          Main issue is that “pkg” will be in your import paths. But some people don’t like their project’s having pkg in the project’s tree either.

                                                                                                    1. 2

                                                                                                      I don’t know much about Nim, but I’m pretty tired of the implication that scripting languages can’t be compiled. Nearly every well-known scripting language has a compiler; stop perpetuating 1990s stereotypes.

                                                                                                      1. 5

                                                                                                        It’s funny how you say “1990s stereotypes” when PHP didn’t have a compiler until 2010.

                                                                                                        1. 7

                                                                                                          While a fair criticism, 2010 was nearly a decade ago. There are certainly many of us who still think of the nineties as merely a decade or so ago.

                                                                                                          1. 3

                                                                                                            One’s perception doesn’t matter, 2010 is 9 years ago (9 and a half if we consider February 2010, the release date of Hip Hop), and calling it “1990s stereotypes” to bring forward an incorrect and overblown statement is not a valid move.

                                                                                                            1. 2

                                                                                                              Perceptions definitely matter when it comes to language and communication. This is because you must communicate such that it is received by the listener’s expectations. A speaker who communicates to the listener’s perceptions will be far more effective. 90’s stereotypes for example may not have been meant to be taken so literally. Now you can say as a listener, “It didn’t work for me, I took it literally” and that’s a fair criticism, however you’re not the only listener, and not every listener will receive it the way you did.

                                                                                                          2. 4

                                                                                                            Ruby was a tree-walking interpreter until 2009 (based on this page).

                                                                                                            Python is said to be compiled but has, and will continue to have, a “Global Interpreter Lock”.

                                                                                                            @technomancy is getting way too overwrought over the imprecise but useful phrase, “compiled language”. Wikipedia: “The term is somewhat vague.” There is a useful separation here. Until we come up with a better name for it, let’s be kind to usage of “compiled language”.

                                                                                                            1. 10

                                                                                                              Python is said to be compiled but has, and will continue to have, a “Global Interpreter Lock”.

                                                                                                              These things are not in opposition to each other. OCaml has a native code compiler, and its runtime system has a GIL (a misnomer: a better name is “global runtime lock”).

                                                                                                              1. 1

                                                                                                                Interesting!

                                                                                                              2. 4

                                                                                                                imprecise but useful phrase

                                                                                                                What do you find this phrase to be useful for?

                                                                                                                You can see in the comments below that the author’s intent was not to describe programs that compile to machine language, but actually to describe programs that can be distributed as single-file executables. (which is also true of Racket, Lua, Forth, and many other languages)

                                                                                                                So it seems that even by declaring “compiled” to mean “compiled to machine language” we haven’t actually achieved clear communication.

                                                                                                                1. 2

                                                                                                                  I’m actually rather interested in how you get single file executables with Lua? Is there a tool that makes it easy, or is it something out of the way?

                                                                                                                  EDIT: I know how to get single file executables with Love2d, and I vaguely recall that it can be done with Lua outside of Love, but it’s certainly not an automated/well-known thing.

                                                                                                                  1. 4

                                                                                                                    Many people simply embed Lua in their C programs (that was the original use case it was designed for) but if you’re not doing that you can streamline it using LuaStatic: https://github.com/ers35/luastatic/

                                                                                                                  2. 2

                                                                                                                    You’re pointing out a second way in which it is imprecise. I’m pointing out that for me – and for a large number of people who don’t know all the things you do – it was useful since it perfectly communicated what the author meant.

                                                                                                                    1. 3

                                                                                                                      Oh, interesting, so you mean to say that when you read “compiled language” you took it to mean “produces a single-file executable”?

                                                                                                                      This is honestly surprising to me because most of the time I see “compiled language” being misused, it’s put in contrast to “interpreted language”, but in fact many interpreted languages have this property of being able to create executables.

                                                                                                                      It’s just a tangled mess of confusion.

                                                                                                                      1. 5

                                                                                                                        Indeed it is. I didn’t mean that I understood “produces a single-file executable.” I meant that he’s pointing towards a divide between two classes of languages, and I understood the rough outline of what languages he was including in both classes.

                                                                                                                        Edit: I can’t define “compiled language” and now I see it has nothing to do with compilation. But I know a “compiled language” when I see it. Most of the time :)

                                                                                                                        1. 3

                                                                                                                          Perhaps a good way to put it is “degree of runtime support that it requires”. Clearly, normal usage of both Nim and Python requires a runtime system to do things for you (e.g. garbage collection). But Nim’s runtime system does less for you than Python’s runtime system does, and gets away with it mostly because Nim can do many of those things at compile time.

                                                                                                                          1. 4

                                                                                                                            Even if a language retrofitted a compiler 20 years ago, it’s hard to move away from the initial programming UX of an interpreted language. Compilation time is a priority, and the experience is to keep people from being aware there’s a compiler. With a focus on UX, I think all your examples in this thread have a clear categorization: Perl, Python, Ruby, Racket, Lua, Node and Forth are all interpreted.

                                                                                                                            1. 4

                                                                                                                              I would frame it differently; I’d say if a language implementation has tooling that makes you manually compile your source into a binary as a separate step before you can even run it, that’s simply bad usability.

                                                                                                                              In the 90s, you had to choose between “I can write efficient code in this language” (basically C, Pascal, or maaaaybe Java) vs “this language has good-to-decent usability.” (nearly everything else) but these days I would like to think that dichotomy is dated and misguided. Modern compilers like rust and google golang clearly are far from being “interpreted languages” but they provide you with a single command to compile and run the code in one fell swoop.

                                                                                                                              1. 4

                                                                                                                                I’m super sympathetic to this framing. Recent languages are really showing me how ill-posed the divide is between categories like static and dynamic, or compiled and interpreted.

                                                                                                                                But it feels a bit off-topic to this thread. When reading what somebody else writes my focus tends to be on understanding what they are trying to say. And this thread dominating the page is a huge distraction IMO.

                                                                                                                                I also quibble with your repeated invocation of “the 90s”. This is a recent advance, like in the 2010s. So I think even your distraction is distractingly phrased :)

                                                                                                                2. 3

                                                                                                                  Are you not barking at the wrong tree ? I don’t find a line where the author implies anything close to it.

                                                                                                                  1. 0

                                                                                                                    I was referring to the title of the post; as if “scripting ease in a complied language” is not something provided by basically every scripting language in existence already.

                                                                                                                    1. 3

                                                                                                                      Specifically, most scripting languages make it nontrivial to package an executable and move it around the filesystem without a shebang line. On Linux, this isn’t a huge issue, but it’s convenient to not have to deal with it on Windows

                                                                                                                      1. 1

                                                                                                                        OK, but that has next to nothing to do with whether there’s a compiler or not. I think what you’re talking about is actually “emits native code” so you should like … say what you mean, instead of the other stuff.

                                                                                                                        1. 1

                                                                                                                          Fair enough.of a point, I suppose. Many people use “compiled” vs “interpreted” to imply runtime properties, not parsing/compilation properties, it isn’t exactly the proper definition.

                                                                                                                          I’ll try to be more precise in the future, but I would like a term for “emits native code” that is less of a mouthful.

                                                                                                                  2. 3

                                                                                                                    Scripting languages can be compiled, but, out of Python, Ruby, Tcl, Perl and Bash, most of them are by default written in such a way that they require code to follow a certain file structure, and if you write a program that is bigger than a single file, you end up having to lug the files around. I know that Tcl has star deploys, and I think that’s what Python wheels are for. Lua code can be wrapped into a single executable, but it’s something that isn’t baked into the standard Lua toolset.

                                                                                                                    1. 3

                                                                                                                      I think it would be helpful to a lot of people if you could give examples for node, Ruby, python, … Maybe you’re just referring to the wrong usage of the word compiler ?

                                                                                                                      EDIT: typo

                                                                                                                      1. 1

                                                                                                                        For python there is Nuitka as far as I know.

                                                                                                                        1. -1

                                                                                                                          Node, Ruby, and Python are all all typically compiled. With Ruby and Node it first goes to bytecode and then usually the hotspots are further JIT-compiled to machine code as an optimization pass; I don’t know as much about Python but it definitely supports compiling to bytecode in the reference implementation.

                                                                                                                          1. 7

                                                                                                                            When talking about “compiled languages”, people typically mean “AOT compiled to machine code”, producing a stand-alone binary file. Python’s official implementation, CPython, interprets bytecode and PyPy has a JIT compiler. V8 (the JS engine in Node) compiles JavaScript to a bytecode and then both interprets and JIT compiles that. Ruby has a similar story. The special thing about Nim is that it has the same ease of use as a “scripting language” but has the benefits of being AOT compiled with a small runtime.

                                                                                                                            1. 1

                                                                                                                              The special thing about Nim is that it has the same ease of use as a “scripting language” but has the benefits of being AOT compiled with a small runtime.

                                                                                                                              The idea that only scripting languages care about ease of use is just plain outdated.

                                                                                                                              In the 1990s it used to be that you could get away with having bad usability if you made up for it with speed, but that is simply not true any more; the bar has been raised across the board for everyone.

                                                                                                                        2. 3

                                                                                                                          Some languages like Dart [1] have first class support for both interpreting and compiling. I dont think its fair to say something like “some random person has a GitHub repo that does this” as being the same thing.

                                                                                                                          1. https://github.com/dart-lang/sdk
                                                                                                                          1. 0

                                                                                                                            That’s the whole point; Dart has a compiler, and any language that doesn’t is very unlikely to be taken seriously.

                                                                                                                            1. 1

                                                                                                                              The point is:

                                                                                                                              Nearly every well-known scripting language has a compiler

                                                                                                                              That may be true, but nearly every well-known scripting language doesnt have an official compiler

                                                                                                                              1. -2

                                                                                                                                Also false; Ruby’s official implementation has had a compiler (YARV) since the 1.9 days; Node.js has used the v8 JIT compiler since the beginning, (not to mention TraceMonkey and its descendants) and python has been compiling to .pyc files for longer than I’ve been a programmer.

                                                                                                                                According to this, Lua has had a compiler since the very beginning: https://www.lua.org/history.html I don’t know much about Perl, but this page claims that “Perl has always had a compiler”: https://metacpan.org/pod/perlcompile

                                                                                                                                The only exception I can think of is BASIC, and that’s just because it’s too old of a language for any of its numerous compilers to qualify as official. (edit: though I think Microsoft QuickBasic had a compiler in the 1980s or early 90s)

                                                                                                                                1. 6

                                                                                                                                  QuickBasic compiled to native code, QBasic was an interpreter, GWBasic compiled to a tokenized form that just made interpretation easier (keywords like IF were replaced with binary short codes)

                                                                                                                                  1. -1

                                                                                                                                    YARV is an interpreter, not a compiler…

                                                                                                                                    https://en.wikipedia.org/wiki/YARV

                                                                                                                                    and .pyc is not an executable file. Do you really not know the different between machine code and bytecode?

                                                                                                                                    https://en.wikipedia.org/wiki/Bytecode

                                                                                                                                    1. 2

                                                                                                                                      Do you really not know the different between machine code and bytecode?

                                                                                                                                      No.

                                                                                                                                      You seem to be under the mistaken assumption that something can’t be a compiler unless the compilation output is machine code I guess?

                                                                                                                                      YARV contains both a compiler (from ruby source -> bytecode) and an interpreter for the bytecode that it compiles, just like Python does for .pyc files.

                                                                                                                          1. 5

                                                                                                                            That actually made me laugh out loud. Please do more. Gmail would be a good candidate. Or the YouTube “recommended for you” that shows even with private browsing. Google’s “don’t be evil” ended a long time ago, and people need to be reminded of that fact.

                                                                                                                            https://en.wikipedia.org/wiki/Don't_be_evil

                                                                                                                            1. 2

                                                                                                                              Enforcing a null return

                                                                                                                              Why is this a thing? Why use a sentinel value [1] instead of a tuple? If you have a function like this:

                                                                                                                              def u1(a1)
                                                                                                                                 return a1.first
                                                                                                                              end
                                                                                                                              

                                                                                                                              The return can be an arbitrary value, including nil. So a sentinel is useless in that case. Better would be:

                                                                                                                              def u1(a1)
                                                                                                                                 if a1 == []
                                                                                                                                   return [false, false]
                                                                                                                                 else
                                                                                                                                   return [a1.first, true]
                                                                                                                                 end
                                                                                                                              end
                                                                                                                              
                                                                                                                              1. https://en.wikipedia.org/wiki/Sentinel_value
                                                                                                                              1. 2

                                                                                                                                The section in question is about ensuring callers don’t use the return value at all (emulating a void or unit return type). Functions have to return something, so it might as well be a specific sentinel value for consistency, even if nothing ever uses the result.

                                                                                                                              1. 2

                                                                                                                                How do you down vote stories?

                                                                                                                                1. 2

                                                                                                                                  Erm… “flag”. The right word is “flag”.

                                                                                                                                1. 39

                                                                                                                                  An interesting parallel, which works for the author, but doesn’t hold universally. Go and Ruby are fundamentally different.

                                                                                                                                  Unlike Rust where the compiler constantly shouts “fuck you” even though you are trying to do your best to serve their majesty and the rules they dictate, Ruby never gets in your way.

                                                                                                                                  This sentence is bad in many ways. First of all: it is toxic. Maybe error messages weren’t that useful when the author tried Rust as they are nowadays, but I doubt that. Failure to understand WHY things fail should be a priority to any developer. And having things actually fail loudly as early as possible should be considered a huge benefit. And then saying “Ruby never gets in your way” is plainly wrong. I would let “never gets in my way” slide, of course.

                                                                                                                                  1. 23

                                                                                                                                    “Ruby never gets in your way”

                                                                                                                                    Ruby gets in the way, but later on. Whether it’s the rare exception that must be tracked down or the large refactor that demands a whole-system understanding of the system, Ruby is not any less in the way than Rust or Java; it gets in the way of getting things done, but in a different manner and at different times.

                                                                                                                                    1. 8

                                                                                                                                      Ruby gets in the way, but later on.

                                                                                                                                      Very much this. I’m sure it’s possible in other languages but I’ve never seen people deliberately create ungreppable methods in any other idiom, such as

                                                                                                                                      %i(foo bar baz).each do |sym|
                                                                                                                                        define_method("prefix_#{sym}_suffix") do
                                                                                                                                          # method body
                                                                                                                                      
                                                                                                                                      1. 7

                                                                                                                                        C++ preprocessor/template dark magic can get horrible quickly. It’s not just that people actively subvert auto-complete or grep. It’s also that these people never document these types of things, and they often do it when there’s an easier, much less bad way to accomplish what they’re trying to do.

                                                                                                                                        1. 3

                                                                                                                                          I generally make strong recommendations to the teams I’m on to keep things greppable, so this is more about best practices than the language itself being significantly flawed. (I understand the argument that foot guns shouldn’t be there to begin with.) define_method can be useful if there is a large number of things you want to iterate over and make methods for. Having said that, I basically never use define_method, myself.

                                                                                                                                          1. 4

                                                                                                                                            Common Lisp - but the debugger system will let you look the method up, and likely the method arises from a macro call-site which you can find from the method invocation etc.

                                                                                                                                            1. 2

                                                                                                                                              I would say the difference is that Common Lisp developers typically try to avoid doing crazy macro stuff if they can avoid it. I suspect most Ruby devs are the same, but there seems to be a vocal minority who love using metaprogramming as much as possible.

                                                                                                                                              1. 4

                                                                                                                                                There’s a similar minority in the CL community. Metaprogramming pushes happy buttons for a bunch of people.

                                                                                                                                                That doesn’t make it any more supportable, mind you.

                                                                                                                                                1. 2

                                                                                                                                                  Back in the day it seemed mostly relegated to high end dev shops. I heard multiple stories about these folks creating metaprogramming monstrosities. Sure it worked, was BDD-tested, etc, but unless you were already familiar with it, the code was pretty hard to touch.

                                                                                                                                                  1. 2

                                                                                                                                                    I’m not sure I buy the implicit argument here that all code must be maximally accessible.

                                                                                                                                                    Metaprogramming is just build-time code execution that is able to impact code at runtime. It is a skill you can learn like any other.

                                                                                                                                                    1. 3

                                                                                                                                                      Sure, but it requires additional thought to read, and makes things much less discoverable by tools (such as grep/ack/ag/etc, as mentioned earlier).

                                                                                                                                                      Accessibility is a virtue when the code is going to be read by people other than the original author.

                                                                                                                                                      1. 2

                                                                                                                                                        I’m not a big fan of it in general, but metaprogramming done well makes code easier to read and understand.

                                                                                                                                                        For example, autowrap is used to create Common Lisp bindings to C and C++ libraries. All of the work is done with a “c-include” macro, which does exactly what it sounds like, and is much easier to read and understand than bindings written by hand. There’s a real life example in the GDAL bindings I’m making. A single macro call generates a few thousand lines of CFFI glue code and definitions.

                                                                                                                                                        Poor discoverability might depend on the implementation. Bindings from autowrap are tab completable in the REPL and everything.

                                                                                                                                              2. 2

                                                                                                                                                Dynamic programming? It’s possible in python too. Useful for generating unit tests methods.

                                                                                                                                                1. 2

                                                                                                                                                  Dynamic programming is something quite different. You’re looking for the term “metaprogramming”.

                                                                                                                                                  1. 1

                                                                                                                                                    thanks for catching

                                                                                                                                                2. 2

                                                                                                                                                  Oh it’s perfectly doable with PHP’s __call :) https://www.php.net/manual/en/language.oop5.overloading.php#object.call

                                                                                                                                                  1. 2

                                                                                                                                                    I’ve switched opinions on this so many times I’ve lost count.

                                                                                                                                                    However, I remain convinced that:

                                                                                                                                                    • metaprogramming is an extremely sharp tool, which can end up hurting you later
                                                                                                                                                    • sharp tools aren’t inherently bad

                                                                                                                                                    Programming will always have ways to shoot yourself in the foot. The best we can do is make those ways explicit, contained, and able to be reasoned about in a sane way.

                                                                                                                                                    1. 2

                                                                                                                                                      I think we can do better. We can eliminate footguns where it makes sense. I have some examples, not all will agree they are footguns. Python eliminated switch statement. Go made it so the default is to not fall through. also Go doesnt have a ?: syntax. Further, Go only allows booleans with conditionals. So you cant do something like:

                                                                                                                                                      n1 := 10
                                                                                                                                                      if n1 {
                                                                                                                                                         println("something")
                                                                                                                                                      }
                                                                                                                                                      

                                                                                                                                                      At first this was annoying, but it make sense. By only allowing this:

                                                                                                                                                      n1 := 10
                                                                                                                                                      if n1 != 0 {
                                                                                                                                                         println("something")
                                                                                                                                                      }
                                                                                                                                                      

                                                                                                                                                      You dont have to think about or answer the question “what fails the condition”? Ruby only fails with nil and false. JavaScript fails with anything falsy. You just avoid that problem alltogether at the cost of a little terseness.

                                                                                                                                                3. 9

                                                                                                                                                  I also find it weird because as a n00b Rust developer, I find the compiler absolutely lovely. It feels like my pal, cheering me on and giving helpful suggestions. (I come from a Java and Javascript world, where compiler messages can be pretty… terse.)

                                                                                                                                                  Yeah, Rust can be difficult to write, but the compiler’s error messages sure make it pleasant.

                                                                                                                                                  1. 8

                                                                                                                                                    “This A -> B looks incorrect, did you mean A -> C?” changes stuff “This A -> C looks incorrect, did you mean A -> B?”

                                                                                                                                                    Not debating the point you’re trying to make but the author sounds like many people who were only starting with Rust. I can 100% feel the sentiment that’s made in the article, and I’m a huge Rust fan and would love to use it more - but right now I’m at a stage where giving up in frustration sometimes happens. And this has nothing to do when it was. You call it toxic, I can wholeheartedly agree with “been there, seen that”.

                                                                                                                                                    1. 3

                                                                                                                                                      This “try {A, B, C} forever” type of errors happens very often with Rust noobs (to clarify: that’s a learning curve, not a dig at someone being a novice) who try to do something that is impossible to do, or impossible to prove to the borrow checker. Unfortunately, the compiler is incapable of understanding that it’s not a problem with a particular line of code, but the whole approach. For example, use of references as if they were pointers digs a deep hole the compiler won’t get you out of (it’ll try to annotate lifetimes instead of telling you to stop using references and use owned types), e.g. don’t write a linked list, use VecDeque.

                                                                                                                                                      The “toxic” bit was about rather harsh framing of the issue. Although, I don’t blame anyone for not liking Rust’s strictness. It has its uses, just like Go/Ruby more lax approaches.

                                                                                                                                                      1. 2

                                                                                                                                                        Congratulations on drafting an even more smug answer to the thread.

                                                                                                                                                        I think you’re missing the point and you also don’t need to explain the exact issue at hand, I was just citing an example of a clearly not impossible thing (the one where I encountered this the last time was simply about getting some form of text into a function, and of course it was a String vs slice problem but it wasn’t obvious at the time).

                                                                                                                                                        And yes, I do think that I prefer a screen full of old Clojure’s unhelpful stack trace than rustc telling me something completely wrong while trying to be helpful. At least then I’m not led on the wrong path because I usually trust my compiler.

                                                                                                                                                        1. 4

                                                                                                                                                          I don’t see how @kornel was being smug here. He’s saying that if a beginner tries something that the borrow checker considers impossible, it will cycle between several incorrect errors instead of raise the actual issue. Is it the “noobs”?

                                                                                                                                                      2. 3

                                                                                                                                                        but right now I’m at a stage where giving up in frustration sometimes happens

                                                                                                                                                        It’s interesting that so many people are running into this. I learned the rules of the borrows checker, knew moves from C++ already, and that was pretty much it. Sure, I sometimes run into problems with the borrows checker (less than when I started writing Rust), but multiple immutable xor single mutable is easy to appease. Lifetime issues can be more difficult, but typically reasoning about the lifetimes solves them pretty quickly.

                                                                                                                                                        I wonder if it has to do with different problem domains that people are trying to tackle (I mostly work on machine learning and natural language processing, have not done much web backend programming with Rust), or the languages that they come from – I used C++ for many years prior, so perhaps I had to reason about ownership anyway (compared to e.g. someone who comes from GC’ed languages)?

                                                                                                                                                        I am not saying that Rust’s learning curve is not steep or that I am some genius that understands Rust better (most definitely not). But more that it would be interesting to investigate which problem domains or programming language backgrounds make it easier/harder to pick up Rust.

                                                                                                                                                        1. 5

                                                                                                                                                          I think the experience of Rust coming from C++ is vastly different than coming from Ruby or Python. Those latter languages shield the programmer from a number of things that need to be thought about with a systems-level language. Confronting those things for the first time is fraught.

                                                                                                                                                          1. 2

                                                                                                                                                            Users of GC’ed languages sometimes have to reason about ownership and lifetimes too. However, they are not punished anywhere as badly as C++ users for failing to do it correctly. They just trap the error, log it, do their best to recover from it, and move on.

                                                                                                                                                            It seems disheartening to explicitly write code whose sole purpose is to recover from errors that you will inevitably make, though.

                                                                                                                                                            1. 2

                                                                                                                                                              Indeed, it’s the unforgiving strictness of Rust ownership that gets people by surprise, even if they know it at a conceptual level.

                                                                                                                                                              The second problem is that with GC design patterns can reference any data from anywhere, e.g. it’s natural to keep mutual parent-child relationships between objects. The borrow checker wants data to be structured as a tree (or DAG), and it comes as a shock that more complex relationships need to be managed explicitly (with refcounting, arenas, etc.)

                                                                                                                                                            2. 2

                                                                                                                                                              No idea. But I only started doing C++ after Rust and I haven’t had any of these problems with move semantics. But I wouldn’t claim I’d never created a bug because of it :P Rust was in learning in my spare time, for C++ I had a whole team to review my code and help me out.

                                                                                                                                                              Also I’m not saying I ran into this constantly - just that it happened several times. And I think my code tends to attract these kinds of problem, if it’s not “5% preparing data into proper data model, then 95% working with it” but being exactly on the surface.. like when i wrote my IRC bot - it’s 90% string handling and a little bit of networking.

                                                                                                                                                          2. 4

                                                                                                                                                            I’ve seen somebody saying something among the lines of “C is harder than Go because Go’s compiler will scream at me if I have an unused import and C’s doesn’t”. I can’t say I understand this mentality.

                                                                                                                                                            1. -2

                                                                                                                                                              Unlike Rust where the compiler constantly shouts “fuck you” even though you are trying to do your best to serve their majesty and the rules they dictate, Ruby never gets in your way.

                                                                                                                                                              I wonder if comments like these come from the kind of people who were throwing a hissy fit as a kid when their teacher told them to do their homework.

                                                                                                                                                              1. 16

                                                                                                                                                                While the original article is needlessly hostile, so is this response. For good or for bad, programming is a gratification-driven activity. It is not hard to see why more people find it gratifying to write a program that runs, rather than a program that type checks.

                                                                                                                                                                Besides, on a purely intuitive level, type errors are not necessarily the easiest way to understand why a program is flawed. Errors, just like anything else, are best understood with examples. Watching your program fail on a concrete input provides that example.

                                                                                                                                                                (Admittedly, fishing for counterexamples in a huge state space is not an approach that scales very well, but what use is scaling if your target audience does not want to try the alternative you suggest even in the tiniest cases?)

                                                                                                                                                                To illustrate the power of modeling concurrency with types, one has to give concrete examples of idiomatic programs written in non-typeful concurrent languages that contain subtle bugs that would have been caught by Rust’s type checker.