1. 13

    One of the Factor devs here. Feel free to ask any questions you might have, and I’ll do my best to answer.

    1. 6

      What do you think is the over arching goal for factor? Were you trying to solve a particular problem which was not solved well by other languages?

      1. 9

        I’m not the inventor, so I wasn’t trying to solve any particular problem as such. I just really liked what I saw.

        For me, Factor provides a sweet spot of easy and very powerful metaprogramming, a simple runtime, and incredible introspectability. The feel of doing development in it is somewhere near a Lisp Machine, since all objects have graphical representations, you have a full REPL with compiler the entire time, and yet you still compile down to fully native code at all times. This makes doing incremental development extremely easy, and I think the amazingly rich standard library and GUI toolkit (for a language with its user base, at least!) speaks to its productivity. And unlike, say, Pharo/Squeak Smalltalk (an old haunt of mine), it uses normal text files for code, so I can use traditional tooling like Git and GitHub to manage development.

        These days, I write a lot less in Factor. Most of that’s due to real life taking precedence as I get older, some of that’s due to other languages closing the gap quite a bit. (Things like Jupyter, or Swift Playgrounds, did not exist when Factor was created, for example.) But Factor remains my preferred environment when I’m trying to learn a new concept or explore a domain I’m not terribly familiar with. Most recently, I had a blast using it for Cryptopals, for example.

        1. 2

          These days, I write a lot less in Factor. Most of that’s due to real life taking precedence as I get older, some of that’s due to other languages closing the gap quite a bit. (Things like Jupyter, or Swift Playgrounds, did not exist when Factor was created, for example.) But Factor remains my preferred environment when I’m trying to learn a new concept or explore a domain I’m not terribly familiar with. Most recently, I had a blast using it for Cryptopals, for example.

          Not to make light of anyone’s excellent work, but whenever I’ve explored Factor this matches what I’ve seen. The community was incredibly vibrant and active a few years back, but recently activity seems to have really fallen off across the board.

          Am I mis-perceiving things or are you not alone in having moved on in some respects to other languages and environments?

          1. 5

            Eh, it’s mixed. Yes, things have slowed down: Slava left, the company using Factor commercially folded, and a lot of us (such as me) have kids and stuff that make coding for fun harder.

            On the other hand, there’s actually a lot of work going on (largely driven by @erg) to make the syntax and runtime a bit more standardized, there have been a number of library improvements from Alexander Iljin, when people have needed more libraries they’ve added them, and so on. If you look at the core repo, you’ll see there honestly been a tremendous amount of activity since the last release. Sure, the pace may be slower, but it’s steady.

            In other words: I don’t think development has stalled, but I think it’s stabilized. For me, that’s great: Factor’s library grows and its stability improves, but things are generally where I left them. I know that same kind of things draws a lot of people to the Common Lisps as well, which also have a slower churn rate.

            1. 2

              I guess I was referring less to the language itself than to the ecosystem around it - blog posts and the like. But you’re right, none of this is an actual measure of a project or community.

              1. 2

                Blog posts are definitely down, but the mailing list is still quite active. I think it depends a bit where you look. But yes, I hear your point.

      2. 3

        Factor is a dynamic language and that makes sense to me: You have values on the stack that know their own types. When you are going to use a value, you check it’s type.

        How do you think a statically typed concatenative language would look? My intuition is that it would be like a reduce operation over all of words in the program. I think I’m a bit hung up due to the lack of formal parameters.

        1. 4

          How do you think a statically typed concatenative language would look?

          Probably exactly like our (optional) static typing. Do note that the compiler could do a lot more than it currently does for optimizations, but you can play with optimized. to see what it’s able to pull off. For even relatively complex cases that involve fixnums, it can basically do ops on straight machine words.

          1.  

            That is neat! Is it used a lot in practice?

            How is the data stack implemented in Factor? Is it just an array of pointers? Or does it use the top bits to determine the types? Tried looking at the repo, but wasn’t sure what file it might be in…

          2. 3

            There was also cat from Diggins and Kleffners thesis

          3. 2

            On the “See some example programs” page, the example program links all give me a 502 error.

            1. 1

              How related is concatenative programming related to array programming (APL)? I feel that some of the concatenative combinators seem familiar to transformers in Nial

              1. 1

                Can the REPL run in a console? I installed the factor package from AUR, and factor-vm seems to only be able to open its own graphical window.

                1. 3

                  I can’t speak to whatever Arch is doing, but I just double-checked that plain factor on my box kicks off a command-line REPL, so I’m not sure what’s going on with their package.

                  That said, I would strongly discourage using the vanilla command-line REPL; you’re missing so much awesomeness. If you really badly want to use a terminal for whatever reason, I would strongly suggest at least using FUEL (our SLIME workalike) in Emacs.

                  1. 1

                    ArchLinux doesn’t install a plain factor (perhaps because the name collides with the factor binary from the coreutils package). There is /usr/bin/factor-vm which is a symlink to /usr/lib/factor/factor. The latter also opens a GUI thing, but I just found out I could factor-vm -run=listener to get a TTY thing, so that’s cool.

                    Thanks.

                    1.  

                      That’s exactly the reason why the factor binary is renamed in the package. Source: Arch Linux packager here.

                      It is kinda sad that there hasn’t been any new releases in years, so if you want to have the new features you’re better off with factor-git.

                      1.  

                        Thanks, I’ll switch to factor-git.

                        1.  

                          I’m not thrilled with that, but there’s an (in my opinion, wrong) attitude that our next release needs to be Perfect™, which means it’s forever delayed. The good news is, as you said and @kas is now doing, that Git is honestly quite stable, so that’s probably the route most people should go for now.

                          1.  

                            I think cutting a release would also send out a signal that Factor is not dead. I can confirm that git is quite stable so maybe there could be a point where tagging a new release might make sense.

                            In any case, thanks for maintaining Factor. I’m not actively using it any more but honestly due to the whole environment and community this was the most fun learning a programming language I’ve ever had, especially a completely different paradigm.

                1. 11

                  Ten years from now we’ll be flooded with takes that FP is wildly overrated and the One True Way To Program is to use… I dunno, zarbomographic programming. And people will have to write “The case against FP is wildly overstated”. The pendulum swings eternal.

                  The gap between theory and practice has fueled the interest in design patterns. As OOP became more popular, programmers looked to them for help with their achitecture. Unfortunately, design patterns can easily become a way to smuggle in overly complex OOP design under a veneer of respectability.

                  People conflate design patterns with OOP, but every paradigm has design patterns. Should you use free monads or monad transformer stacks?

                  1. 7

                    I largely agree with you, but I wonder if part of the problem with OO was actually the marketing machine behind it. Sun dumped so much money into Java and put so much “thought leadership” into the world that the pendulum swung hard in the other direction. I don’t think there is as much force behind functional programming right now. That could change, of course.

                    1. 9

                      Java played a big role here, but OOP was already becoming dominant well before Java appeared. The Gang of Four book was originally written in Smalltalk and C++. Java’s main impact was to shrink the field to C++ and Java, killing competitors like Smalltalk, Beta, SIMULA, and Eiffel in the process.

                      1. 3

                        Yeah, I think shrinking the design space being explored could have had a part in that. You have a language with big claims, you denigrate and destroy alternatives, and just wait. It’s a recipe for backlash.

                    2. 7

                      I don’t object to your prediction, but how can you tell whether this is a pointless hype cycle or forward progress? Maybe these new paradigms do improve on the previous iteration and maybe zarbomographic programming will indeed be even better.

                      1. 3

                        Most of the OOP is okay vs OOP is not okay debate revolves around whether Inheritance was a good idea or not. And oddly most of the time everyone agrees we’d be better off it wasn’t used most of the time. All the rest of the arguments devolve into the classic koan about closures and objects being the same thing and people talking past each other.

                      1. 8

                        I am compelled to drop in Stephen Ball’s Deliberate Git video every time commit messages come up. It’s been 7 years since he presented that talk at Steel City Ruby 2013 and I still show that video to interns, early career folks, and new team members of every vintage at least once per year if not more often.

                        1. 4

                          I actually work with Stephen now, and the quality of our git commits has gone up tremendously!

                          1. 2

                            Yeah, that’s what I immediately thought of. It’s a great video and I probably need to rewatch it.

                            1. 1

                              Thanks, I’ll give it a watch.

                            1. 1

                              Just want to point out, in SQL Server

                              A CTE must be followed by a single SELECT, INSERT, UPDATE, or DELETE statement

                              so which databases let you run multiple selects on a single CTE? Because that sounds great. Postgres docs talk about “one query” but I’ll just try it myself I guess

                              1. 1

                                I’m using PostgreSQL in the examples, and I’ve worked with Oracle in the past, and I don’t know of such a limit on neither.

                                1. 1

                                  I believe it’s a sql server limitation, note however that can define multiple ctes and a cte can reference a previously defined cte. This is the most common workaround, but sometimes you still need a temp table (rarely for me at least)

                                  Just looked at the example again and that is what the author is doing, there’s 2 ctes there.

                                  1. 1

                                    Do you happen to know if you can do updates or deletes inside a CTE in SQL Server? I hadn’t ever seen that done until this article. Wasn’t sure if it was just a postgres thing.

                                    1. 2

                                      I don’t have this type of experience with SQLServer. Maybe someone else here can provide an answer.

                                1. 14

                                  I’d need to be convinced that another interpreter solves any major problems of cross-language interoperability. As far as I can tell, the challenge is squaring the circle of different semantics.

                                  What happens when you take a Rust affine value, pass it to Python, which assigns a few copies of it around, and passes all of those copies back? What happens when you pass something with a destructor to a language that doesn’t support destructors? What happens with weak references that are implicitly nullable when you pass them to a language without NULL?

                                  Getting all of that to work is where the effort in cross-language interop lies.

                                  You might be able to get it to work in languages that feel close – the .NET CLR does this, for example. But getting Haskell, C++, Rust, and Python to easily interoperate without tons of glue code seems… unlikely.

                                  And if you’re ok with glue code, the C ABI and the various language FFIs more or less lets you do the job.

                                  1. 6

                                    C ABI does the job, but I think I am not revealing anything shocking when I say C ABI could be greatly improved. Have you seen Fine-grained Language Composition by Laurence Tratt? It is a clear proof of concept of what is possible, and we are very far from it.

                                    1. 3

                                      Of course there’s room for improvement – the x86_64 calling convention is way too complicated. But that’s beside the point. The hard part isn’t the calling convention or the VM, it’s figuring out how to handle all of the language semantics.

                                      That proof of concept is interesting – but I didn’t see any challenging features shared. What does PHP do with a StopIteration exception from python? Can it consume a python iterator at all? From that description, it seems like you can’t easily pass a list from PHP to python – you need to manually adapt it. And you can get exceptions if the adapted PHP variable stops looking like a list.

                                      And, these are two languages that most people would consider close.

                                      1. 2

                                        the x86_64 calling convention is way too complicated

                                        It’s quite simple. First few integral parameters in registers. First few floating parameters in floating registers. Further arguments on the stack. Large parameters (structs) passed either as pointers or on the stack.

                                        1. 2

                                          Large parameters (structs) passed either as pointers or on the stack.

                                          The complexity comes from how small structs are passed and returned. It’s not unmanagable, but it’s enough to be painful compared to the Windows ABI. The rules around types interactions in small structs are more complicated than they need to be. This makes determining which registers to use to pass a struct overly complex.

                                        2. 2

                                          And, these are two languages that most people would consider close.

                                          I made that mistake when we started that work, but was quickly disabused of it. PHP and Python look close only if you don’t look closely, mostly because PHP is a very unusual language (e.g. PHP’s references, for example, are rather unique). You might find the full paper (https://soft-dev.org/pubs/html/barrett_bolz_diekmann_tratt__fine_grained_language_composition/) has more detail about the challenges and how they were resolved. For example, Section 6 tackles cross-language variable scoping, which stretched my (admittedly meagre) language design abilities to, and possibly beyond, their maximum!

                                      2. 4

                                        Rather than cross-language interoperability, I think that the real value would be in providing a single platform that could be ported to different systems and brings tons of existing code to them. Basically, taking the JVM portability advantage and democratizing it. It would really benefit niche systems. (Commoditize your compliments!)

                                        1. 1

                                          But getting Haskell, C++, Rust, and Python to easily interoperate without tons of glue code seems… unlikely.

                                          But that doesn’t mean there wouldn’t be wins in other areas. Programming in Haxe was like programming in 1 + (targets * .5) languages because you had to be mindful of how everything would be translated. However, things like unit testing were O(1) because the test suites would be automagically generated and run for each target.

                                          And if you’re ok with glue code, the C ABI and the various language FFIs more or less lets you do the job.

                                          I agree with you insofar that I’m skeptical language interoperability can go beyond functional interfaces passing serializable data structures. However, I think we can significantly improve on the C FFI baseline and piping strings around.

                                          TruffleRuby’s implementation of the Ruby C FFI requires interpreting C code, yet it still manages to beat the pants off of mainline because the common AST representation of the two languages allows the JVM to perform optimizations on a shared in-memory representation of their data. Or take the WASM type spec, which would allow for similar optimizations on similar data structures while providing sane defaults when converting between primitive values.

                                        1. 5

                                          Perfecting my kugel Yerushalmi. I’m close. I need to add more pepper.

                                          1. 2

                                            Oh that sounds nice! My friend’s mom makes a vegan sweet potato based kugel that I love. I need to learn how to make it…

                                          1. 1

                                            This is more meta, but I somehow often end up debugging integration tests or testsets which take very long to run, and are hard to debug because of their size. It still feels like I’m missing some trick to do this.

                                            My current workflow is:

                                            1. Start testsuite
                                            2. Wait (can’t use the repo at this point) for almost an hour. Hope there is non-coding work to do, can’t use repo at this point.
                                            3. Cry tears of joy if there are no failing testcases. Else, pick a failing testcase
                                            4. Replicate the failure manually by replicating the behavior of the test script (in an in-house language, hundreds or thousands of lines long) – might take a while
                                            5. Debug by using printfs (there is no debugger for the platform I’m developing for yet) – this is usually the easy part

                                            At my last job there we debugged the code by comparing it to an Excel sheet. Somehow Excel was faster than the model itself (I fixed this in the end), and the model took 1+ hour to run. Unfortunately the Excel sheet contained many errors.

                                            1. 1

                                              I feel a similar pain. I work with a lot of long running data pipelines. Since all of the steps are interconnected a failure in a later step might be caused by data in an earlier step. As a result, I might have to rerun a pipeline from the beginning to make sure that the issue is fixed.

                                              To debug, I’ll often rerun a single partition of the pipeline locally, sometimes on a subset of the data. It ends up being quite a bit faster that way, but if a step takes a while then it makes it tricky to work on anything else.

                                            1. 1

                                              I’ve been unknowingly using Emacs Lisp since much earlier – not in the sense of writing packages – my old man taught me how to use Emacs when I was nine

                                              (This makes me jealous)

                                              I decided to scrap my BMP encoder and go with PPM instead. Netpbm is text-based

                                              I was playing around with a NetPPM encoder myself in Scheme, just a few weeks ago, having have read the same article, and storage-wise, it’s helpful to remember that NetPPM can also be generated using binary data. The header stays the same, but after the P6 100 200 256 part, you just write bytes.

                                              Clojure’s license makes it a complete non starter for me, sorry. Live free or die.

                                              What’s this about? I recently read RMS saying that an argument to not consider Clojure a proper lisp is that it’s (allegedly, idk) based on cons-cells, so that “the most basic programming techniques of Lisp don’t work in Clojure”.

                                              1. 6

                                                What’s this about?

                                                EPLv1 isn’t GPL-compatible. Not totally evil, but it’s enough for me to want to avoid using it.

                                                https://www.eclipse.org/legal/eplfaq.php#GPLCOMPATIBLE

                                                1. 3

                                                  Fun facts:

                                                  • the EPLv2 is GPL-compatible
                                                  • the Clojure developers have collected copyright assignment from all contributors, which would be needed to update the license to use it
                                                  • despite this, the Clojure developers have indicated that they are uninterested in doing so
                                                  1. 1

                                                    Would it make you feel better or worse if it were MIT?

                                                    1. 2

                                                      If Clojure were licensed under MIT? I would feel better, as it’s compatible with the GPL.

                                                  2. 3

                                                    If you’re interested in Clojure, by the way, Phil Hagelberg (who wrote Leiningen, the standard Clojure build tool) is nowadays contributing a lot to Fennel (which is also mentioned in the article, and compiles down to Lua).

                                                    Libre Lounge has a really fascinating interview with him that covers that topic – caveat auditor, I ended up buying his Atreus keyboard after listening to the podcast.

                                                    1. 5

                                                      Careful, for he lurks among us. Some say that if you say the word “technomancy” out loud three times he may appear.

                                                    2. 2

                                                      From what I can see, Clojure uses the Eclipse Public License? (based on https://github.com/clojure/clojure).

                                                      Is the EPL that problematic?

                                                    1. 5

                                                      Python is an interpreted language, i.e., a scripting language.

                                                      So that’s what a scripting language is, eh? One that has an interpreter?

                                                      Behold, the C++ scripting language:

                                                      https://root.cern/cling/

                                                      1. 3

                                                        Excuse me, but python is compiled to VM byte code like Java. Therefore it is a serious programming language, unlike those silly scripting languages like C++.

                                                      1. 6

                                                        Following through to the main Pyret description page, I don’t know if this is new to Pyret or half-inched from some amazing promethean functional language I’ve never heard of, but this is one of the best things I’ve come across in a new-to-me language for a very long time:

                                                        Functions can end in a where: clause that holds unit tests for the function. These assertions are checked dynamically.

                                                        Maybe not awesome for performance but what a boon for function-level correctness without having to dive deep into complex types. Also

                                                        you can also write check: blocks at the top level, for general program testing

                                                        All-round good thinking about consistency and coherence from the ground up. Rad.

                                                        1. 3

                                                          Might be taking contracts from Eiffel/OO languages and/or pattern matching guards from Erlang/Elixir/functional languages. Not sure what the lineage of Pyret is though.

                                                          1. 3

                                                            Might be taking contracts from Eiffel

                                                            That’s what I thought at first, too. But a look at their example shows that they aren’t contracts/invariants, they’re literally just standard unit tests. The only difference between these and, say, a D unit test, is that these are syntactically tied to the function. This affords you better test failure messages, at least.

                                                          2. 1

                                                            That “where: “ clause is kinda neat, and I’ve never seen it before either. Seems like there shouldn’t be any performance impact if the compiler is smart enough.

                                                            1. 1

                                                              I wish they did not use where as the keyword. I like how Haksell uses where to define small local functions, and it fits better there.

                                                          1. 67

                                                            IMHO, I think tone policing should be allowed. Lobste.rs is more than just link aggregation, it’s a discussion community. The way a community becomes what it wants to be is by the soft pressure of discussing community norms. Disallowing tone policing would remove an important tool that allows us to decide the tone of the site without having to spell everything out in some sort of policy document.

                                                            1. 5

                                                              Tone policing absolutely has a place in community building for communities like lobste.rs.

                                                              I’d argue that it makes more sense to discuss tone in private messages than in comment sections. A comment criticizing tone is difficult to respond to, and when it does gets a response, it tends to create a great big derailed off-topic thread taking up 90% of the page, like in the discussion linked above. A private message about tone is harder to ignore and easier to resolve (at least for me).

                                                              1. 1

                                                                By using the term ‘tone policing’, you have already made concession to the SJWs. The term ‘tone policing’ has an authoritarian implication, while the nature of normal human conversation is a lot more bilateral. When you make fun of your friend’s clothing, what you are saying is “from my experience, our society will not consider your choice of clothing to communicate high value, and you might lose social status and related opportunities by wearing XYZ”. You are doing this to help your friend, not to belittle him.

                                                                The irony is that by trying to stop ‘tone policing’, the SJWs are themselves guilty of what they are charging, Because they want to BAN a particular type of comment. Just SJW things I guess.

                                                                And of course they want to enshrine their world view as institutional a priori truth. ‘Pretending’ systemic bias isn’t real. Note that not only do they assume it’s real, they assume that everybody agrees. And only the trolls and alt-rights or otherwise bad-people just ‘pretend’ it’s not real.

                                                                1. 14

                                                                  🤔 but you don’t think there’s anything wrong with the tone of this comment?

                                                                  1. 2

                                                                    Yes, and I also think there is something wrong with the intention of your comment.

                                                                    LibertarianlLama is arguing that ‘tone policing’ is not the right term and that those using it are shooting themselves in the foot, going off on a tangent where they attribute it to the assumed membership of tone policers to a certain social group (SJW’s) and certain properties of members of that group.

                                                                    Now there’s a whole bunch of things there that we can argue about, among which whether it’s unconstructive, inflammatory, etc,. but trying to shame them for hypocrisy (which is what your comment boils down to) is not one of them, because they weren’t arguing against commenting on the tone of comments.

                                                                    1. 2

                                                                      Are you tone-policing?

                                                                      1. 6

                                                                        I think @lorddimwit’s point is that the answer to your question is “YES”. Your comment is objectionable to me as well.

                                                                        1. 10

                                                                          I don’t think his comment was particularly rude or unnecessary at all. In fact it’s quite a blunt, indifferent explanation of how “tone policing” is quite a loaded expression.

                                                                          1. 5

                                                                            And it absolutely is. Having, myself, gone through a fairly radical positive attitude transformation over the last few years, spurred in large part by feedback from others, I personally believe gently nudging people away from unproductive negativity and conflict-seeking towards a hopefull and cooperative attitude can have a positive impact both on the life of that individual (e.g. me), and the lives of the individuals that person goes on to interact with. To conflate this with “tone policing” and suggest that it should be avoided is simply innacurate. Words matter. Tone matters.

                                                                        2. 1

                                                                          Of course. I think tone policing is fine, and your comment is not.

                                                                          1. 3

                                                                            Well I think your comment is not either.

                                                                    2. 1

                                                                      Little late to the discussion, but this was my exact purpose in replying to that comment. My base assumption was that monokrome might not have been aware of how their question could be received and to provide pointers so that they could get their point across more successfully.

                                                                      Now, I am not an expert at internet communication, nor do I have any power on this site to enforce my views on communication. I have been in a number of internet arguments over the years and suspect I will be in more.

                                                                      Instead, I intervened because I think the community is filled with intelligent and engaged people who want to have open discussions and learn from one another. I thought that a valuable discussion could come from monokrome’s comment and I did not like the direction the comments were taking. I don’t know if my comment succeeded the way I hoped, but I hope that a constructive comment sucked some of the air out of the destructive ones.

                                                                      As a community I think that we need to enforce norms. I don’t want us to become as caustic as the orange site. It stresses me out. Lobsters, by comparison, is place where people have their differences, but reasonable conversations seem to be the default.

                                                                    1. 29

                                                                      I cannot help myself but to imagine a open source ideas incubator governed by:

                                                                      Antirez, Linus, Mike Pall (LuaJit), Rich Hickey (Clojure)

                                                                      Perhaps, they would find it difficult to work together, but they all have something in common:

                                                                      1. They cannot be easily manipulated
                                                                      2. they do not want to manipulate others
                                                                      3. They are visionaries
                                                                      4. They express themselves through software (on both technical and conceptual levels)
                                                                      5. They work very hard, for very long time, based on a believe and passion alone
                                                                      6. They are not afraid to challenge ‘status quo’

                                                                      The combination of the above, perhaps is rare, and finding a way to explore their combined wisdoms, quirks, and talents – would be very neat and beneficial to society as a whole.

                                                                      If such a cooperative is successful, I would also hope that they would figure out a way to find the next generation of folks so that the process continues.

                                                                      1. 5

                                                                        I like it, but maybe sub Mike Pall with Roberto Ierusalimschy because he seems to meet all the same criteria except has a wider range of projects he’s involved in and presents lots of white papers and research around his projects. [1]

                                                                        No offence to Mike Pall, of course, LuaJIT is still alien software in my book and “he” still could be an anonymous group of genius computer scientists sharing a pseudonym afaik.

                                                                        [1] - http://www.inf.puc-rio.br/%7Eroberto/cvpub.html

                                                                        1. 3

                                                                          Why are there no women in this list?

                                                                          1. 47

                                                                            While I agree with the sentiment, I think the short question comes off as aggressive. Instead, you can make a suggestion to avoid putting all of the onus on the previous commenter.

                                                                            For example, “I noticed your list doesn’t have any women. What about ___ or ___? They have a proven track record on $PROJECT.”

                                                                            It brings attention to talented women in the industry and provides people with a jumping off point to learn about their accomplishments. Asking questions calls attention to biases, but it doesn’t always inform.

                                                                            1. 10

                                                                              Some random posters list if 4 of their favorite open source project leaders doesn’t need to add a token woman. Asking politely would have made it harder to see how completely ridiculous this is.

                                                                              1. -1

                                                                                You mistakenly assumed the sentiment is to call out a user instead of pointing out the systems that have led to there not being a lot of women for them to include.

                                                                                The question is about why there aren’t comparably a lot of women noted in open source and not meant to call out OP directly.

                                                                                Y’all are being defensive where it isn’t needed and taking this personally instead of as a time to reflect on why open source culture is how it is and how behaviors in the current system are the problem.

                                                                                Honestly, with 23 upvotes and 22 downvoting and having to share your defense, all we’ve done instead is identify the problem even more concretely than would have happened if y’all would have taken the comment for what it was and not for what it wasn’t.

                                                                                For those of you labeling this as “off-topic” specifically, I would argue that it isn’t. I’m asking about a list in response to a comment about a list. The list is the topic in context of this thread.

                                                                                Hopefully this comes to fruition, because it’s unfortunately too relevant here. https://lobste.rs/s/lpvcsm/proposal_for_moderation_policies_no_tone

                                                                                1. 5

                                                                                  Y’all are being defensive where it isn’t needed and taking this personally instead of as a time to reflect on why open source culture is how it is and how behaviors in the current system are the problem.

                                                                                  If you wanted people to reflect on it, then posting a pointed question is not the way to go. Something similar to this would have been waaay better at getting people to think:

                                                                                  I’d love to see a few women contributors on that list too. Do you know any who would fit that team?

                                                                                  I’m not here to tone police comments because I actually agree with you that we should encourage women to join us in these endeavours, but you are not helping that cause. You are creating division by using bad wording and being more focused on being “correct”. Take this loss and let the issue die down. The trenches have already been dug here.

                                                                                  1. 1

                                                                                    If you wanted people to reflect on it, then posting a pointed question is not the way to go. Something similar to this…:

                                                                                    I’d love to see a few women contributors on that list too. Do you know any who would fit that team?

                                                                                    Your new question here has absolutely nothing to do with the one that was posted. monokrome was not looking for someone to offer up the name of a woman in tech, but to discuss the reasons why there might not be one on the list in the first place.

                                                                                    I’m not here to tone police comments

                                                                                    Seems to me that not only are you here to tone police, but also to police the content of the comment; to divert away from a meaningful and difficult discussion of under-representation (which you have no obligation to participate in), and instead re-frame it as a pedestrian question of “could someone please identify a women in tech”.

                                                                                    1. 1

                                                                                      discuss the reasons why there might not be [a female programmer] on the list in the first place.

                                                                                      Why should this discussion happen on lobste.rs? I thought we only allow content related to programming?

                                                                                  2. 3

                                                                                    Well, it seems that I misunderstood your comment here. I imagine that many others did too. I think that is the key issue here. Having a comment that explicitly calls out the system instead of the list would have made a difference for me. Calling out just the list makes it seem like the problem is with the person who created the list.

                                                                                    As for tone policing, I do believe systemic biases exist and need to be discussed. However, I think the way we discuss them is important.

                                                                                    I like lobsters a lot and I don’t like seeing discussions devolve into a locked in flame war. My comment was meant to provide constructive feedback and to take air away from destructive comments. My goal isn’t to prevent you from speaking, but to make it easier for your to be heard, if that makes sense.

                                                                                2. 32

                                                                                  Cynical answer: building rep in the open source world takes a lot of time, and it’s been historically so woman-hostile that women haven’t been given a chance to build serious rep.

                                                                                  Hopeful answer: Jessie Frazelle, maybe? My niche is dominated by academics so I don’t know a lot of FLOSS names outside of formal methods.

                                                                                  1. 6

                                                                                    Speaking of Jessie Frazelle, I’ve recently learnt that she’s teaming up with a few other brilliant people at https://oxide.computer/, where you’ll find (among others) Bryan Cantrill and Steve Klabnik.

                                                                                    1. 3

                                                                                      Well, that’s cool :)

                                                                                    2. 12

                                                                                      Even the women who have built names for themselves in tech, are less likely to be known by men. So there’s that. I can think of a bunch of amazing people but not specifically in open source…

                                                                                      1. 8

                                                                                        Strange assumption. What are open-source projects run by women that people should know about?

                                                                                        1. 30

                                                                                          Cynical comment: Not identifying as a woman, but having “seen some things” over the years, I can’t help but think that some of the reasons we don’t find so many woman leading open source (surely there are many, though!) is because it’s dangerous to put yourself out there as a woman. How many sexual violence threats do you think a woman would receive if they were the maintainer of Redis, very opinionated, and shutdown ideas because they didn’t fit the direction she wanted to take? I bet the number is not 0.

                                                                                          1. 11

                                                                                            You-ain’t-seen-cynical-yet comment: How many death threats do you think a man receives if they’re the maintainer of Redis, very opinionated, etc? The number is very not 0. Anyone who has ever done anything significant has been on the receiving side of some harassment. Today’s effortless communication magnifies the effect, but I’m sure there were people writing “Ο Ευριπίδης τρώει σκατά” on the walls in 420 BC. The difference is whether you let it derail you. The successful ones are the ones who ignore that shit. So why do those who persevere tend to be “privileged”? A very simple psychological reason. Perceived-privilege means having no other face-saving option. If you bail out from a visible position after receiving some harassment and you say “I quit because I felt threatened as a woman” or “I quit because I felt threatened as a person of color” or whatever, there’s a fair chance you’ll be the subject of articles praising your heroism in exposing the harsh reality faced by members of $GROUP who dare to lead. Do the same thing as a straight white male, and, well, you’re a quitter. The narrative expects success from you, it expects you to keep your problems to yourself, and you’d better not have any insecurities. Underdogs are expected to battle with self-doubt; on you, it’s childish and absurd, so forge ahead or be a failure forever.

                                                                                            1. 9

                                                                                              Or maybe it’s because those groups are often at risk in their every day life and take threats on themselves seriously due to past experience?

                                                                                              1. 2

                                                                                                That would be a pretty big mistake. Regardless of who you are, the supply of people willing to make threats still outnumbers the supply of people capable of carrying them out a million to one. The harm here comes from labels themselves.

                                                                                                1. 15

                                                                                                  I think you’re arguing in good faith, so I’ll provide a good faith response. The problem isn’t one of existence but degree. I’ve been the target of internet outrage mobs and serial harassers, and both are terrifying. I lived through them, yes, but it’s absolutely awful to have someone constantly email you screeds from new, unblocked email addresses about how you’re awful and deserve to die. I’m also a straight (((white))) male and have only really gotten attacked over things I wrote, not my identity. Would I have muscled through it and continued writing if I had gotten 10x the amount of online harassment? I don’t know, maybe I would have managed, maybe it would have been too much for me. But there’s certainly some magnitude of abuse that would have gotten me to stop drawing attention to myself. Women and minorities get more abuse online, so it’s more likely to cross that line.

                                                                                                  Summary: everybody has tolerance level, there’s probably no significant difference in what the tolerance level is for men and women, but women get so much more abuse online it’s more likely to cross that tolerance level.

                                                                                                  1. 3

                                                                                                    Different people do have different tolerance levels; it’s easy to see that some people withstand massive abuse, and some don’t, and the differentiating factor is self-esteem, or confidence, or arrogance, however you want to interpret it. So why do the ones with that confidence tend to look alike? Freely granted, one reason is because there is injustice in the world, and a track record of success builds confidence.

                                                                                                    But that can’t be all either, and here is where my dark fear lies: by labeling people as disadvantaged, we disadvantage them. Psychology is a terribly powerful force. If you believe that the problems you face are the same problems shared by all human beings, trying to make something of our lives in an indifferent universe, then any successful human being can be a role model to draw strength from. If you believe that your problems are special, that only a few share your circumstances enough to understand, then you’re reliant on a role model who is “like you”. That mode of thinking used to be the province of moody teenagers, and growing past it was the sign of an adult — but now it’s just normal, and labeling strongly encourages it. All I want is a world where people tell themselves “I am a human being. I have been blessed with intelligence that can overcome any problem. I cannot ask for any more.”

                                                                                                    1. 1

                                                                                                      So, is your solution is to just ignore the problem and not talk about it? If so, I think that there has been enough proof to show that only makes the problem worse.

                                                                                                      1. 2

                                                                                                        No, just the opposite. If I just wanted to ignore problems and not talk about things, I think I could do that perfectly well on my own, without the aid of the internet. But because I have a foolish compulsion to try to make a positive difference in the world and help other human beings, you see me here. Thankfully for all involved, mostly that compulsion expresses itself as tens of thousands of hours of technical volunteering, but occasionally a bit of freelance philosophizing bubbles up. Agree with me or disagree with me, but kindly don’t misrepresent me.

                                                                                              2. 5

                                                                                                Less death threats than a woman receives. I’ve had multiple people threaten to murder me just because I was streaming video games on Twitch, and I’ve never had more than a dozen or so viewers. If a woman was maintaining something as big as Redis, they’d be getting more death threats than Antirez.

                                                                                                Nobody should be getting death threats, but that’s just the truth.

                                                                                                1. 2

                                                                                                  I think it’s much more likely that people quit silently all the time, whether they’re URMs or not. It just doesn’t get publicized so much, so it’s not as visible. But when people quit publicly, it’s much more visible, so it’s what we tend to focus on.

                                                                                              3. 3

                                                                                                I am choosing not to answer this because (1) it’s beside the point, and (2) as I said in the remark you’re replying to, nothing comes to mind. I’m not clear why you felt the need to ask for something that I already said I don’t have.

                                                                                              4. 2

                                                                                                Yeah, the way women are treated in open source doesn’t help the situation.

                                                                                              5. 1

                                                                                                I was hoping people would see it this way but it seems everybody takes it defensively instead of identifying problems. Thanks for not being one of them :)

                                                                                              6. 11

                                                                                                What do you hope to gain by asking such a pointed question that comes across as very aggressive?

                                                                                                  1. 1

                                                                                                    To be clear: This is not trolling or off topic. This is a reply to a post that directly mentions the comment which it was replying to, and the content that this comment represents is exactly the kind of content that the link represents. I am not trolling, but want you to be aware that this behavior is being noticed.

                                                                                                    The constant flagging of comments only proves that flags can’t be used to do anything like banning people, because people are too immature, defensive, and unreasonable to flag properly.

                                                                                                1. 33

                                                                                                  And here you see why Antirez wants out.

                                                                                                  1. 13

                                                                                                    Exactly, too many people in the industry spend their time stirring up controversy. Those folk do not provide solutions and just cause people like Antirez problems and a heacache. They complain and paint people that provide tremendous benefit to the company in a bad light.

                                                                                                  2. 18

                                                                                                    Go ahead, make your nomination.

                                                                                                    1. 11

                                                                                                      Why are there no Uzbekistanis on this list?

                                                                                                      1. 28

                                                                                                        Алекса́ндра Аса́новна Элбакя́н isn’t Uzbekistani but Kazakhstani (so not part of the usual US/Europe community), but definitely matches the criteria in the list, through Sci Hub challenges the status quo in ways that - in the long term - may exceed even Linus’ contributions and is even a woman (see the question up-thread for why that matters). So, there’s my nomination.

                                                                                                        1. 3

                                                                                                          I don’t know, in the long run, if Sci Hub will be more influential than Linux. But as of 2020 it’s absolutely more influential than Redis, LuaJIT, and Clojure.

                                                                                                          1. 2

                                                                                                            Hahaha, thank you for this answer :)

                                                                                                          2. 4

                                                                                                            Uzbekistanis make up 0.4% of the world population. Women make up ~50% of it.

                                                                                                            1. -2

                                                                                                              Women make up ~50% of it.

                                                                                                              What are you implying exactly?

                                                                                                          3. 1

                                                                                                            Because Redis, Linux, LuaJit, nor Clojure were made by women.

                                                                                                            1. -9

                                                                                                              Because none of them has come out as trans yet.

                                                                                                              1. 6

                                                                                                                Per my sister comment, I don’t think a short, quipy comment helps further this discussion. This comment thread is potentially sensitive and I do not think we should escalate it.

                                                                                                                1. 6

                                                                                                                  There is nothing we as users can do. This site is just going to continue going down the shitter unless the admins/mods start enforcing rules, or replacing the terrible, terrible, upvote-comment-tree comment format with a traditional forum layout. If I was running this site, I would ban this person (and everyone who wrote a snarky reply) for 7 days, leave the comment in-tact, and prevent people from replying to it. It’s simple and gets the message across.

                                                                                                                  1. 2

                                                                                                                    Could you link to the comment you’re referring to? I can see a couple candidates and don’t want to misunderstand you by guessing.

                                                                                                                    Also, what specific rule would you like to see added and enforced?

                                                                                                                    1. 1

                                                                                                                      “Why are there no women in this list?” is rather passive aggressive and in no way constructive, I think it warrants a temp-ban. It’s a zero effort cheap shot. Look at the comments that spawned from it. Would be a tragedy if lobste.rs became like HN, Reddit, or, godforbid, Twitter. </2 cents>

                                                                                                                      1. 2

                                                                                                                        Not to mention that the poster’s Twitter account is suspended – that takes some effort.

                                                                                                                        1. 1

                                                                                                                          moved reply to meta thread for the sake of conversation there: https://lobste.rs/s/lpvcsm/proposal_for_moderation_policies_no_tone#c_fu0xzl

                                                                                                                        2. 1

                                                                                                                          Sorry I shouldn’t have used the word “rule”. I don’t think specific rules are strictly necessary. All I’m saying is, you’re admin, it’s your site, you have all the power and can do basically whatever you want. I feel like punishing the bad actors in a public way would fix a lot of things.

                                                                                                                          SomethingAwful and Facepunch had pretty good mod teams and tooling if you want something to go off of.

                                                                                                                        3. 1

                                                                                                                          Well, now we know why N64N64 isn’t a mod.

                                                                                                                      2. 2

                                                                                                                        What is your problem?

                                                                                                                    2. 2

                                                                                                                      RMS fails the second criteria? If not, why did you choose not to include him?

                                                                                                                      1. 25

                                                                                                                        I can imagine those four working well together. I cannot imagine them working well with RMS.

                                                                                                                        1. 1

                                                                                                                          This comment is especially funny when juxtaposed with https://lobste.rs/s/gigoo8/end_redis_adventure#c_tf95fm - as RMS is well known for his ‘gross’ approach to sexual advances.

                                                                                                                        2. 1

                                                                                                                          While I understand the idea, I wonder whether such a thing is in general a good idea. You know, when someone is good and successful at X, it doesn’t necessarily mean that they are also good at making others good and successful at X.

                                                                                                                          This is based on a complete assumption. What if these people got successful because they went their own road. I think that’s what these people have in common. Following the steps of one of them closely (which might be the main thing they can provide) might be the complete opposite.

                                                                                                                          Without wanting to go too far from that thought, I also see that in day to day work, that is people assuming they do the right thing based on someone else having done the same thing. While this of course might be true and is a good approach in many situations, it might not be.

                                                                                                                        1. 3

                                                                                                                          I’m learning F# now, I’m practicing with Exercism exercises (they provide tests and exercise description). One exercise is a simple Forth (subset). After skimming this article (only superficially, as I had a pretty long day) I found some aspects similar to my solution.

                                                                                                                          I share it if anybody might be interested. Feedback is welcome, but keep in mind, it is practise, not meant to be fast/efficient/optimal/user friendly. Actually it has no shell/repl.

                                                                                                                          https://gist.github.com/kodfodrasz/d9a8054d6d5d86ff5a2687d51150f02d

                                                                                                                          1. 2

                                                                                                                            I don’t know anything about F#, so I can’t give much feedback, but it looks neat! I can see some similarities to the Pointless code. Thanks for sharing!

                                                                                                                            1. 1

                                                                                                                              I’ve been doing exercism for Elixir and I am really looking forward to the Forth problem. It seems like it’ll be fun and I really want to see what the community solutions look like.

                                                                                                                              1. 1

                                                                                                                                Where’s the return stack, or the dictionary? The immediate time macros? Memory?

                                                                                                                                It’s very cool, but it’s just a stack computer. Forth at a minimum is a two stack language.

                                                                                                                                1. 1

                                                                                                                                  a simple Forth (subset)

                                                                                                                                  1. 1

                                                                                                                                    But it’s only technically a subset of Forth. It’s a stack machine that processes generic stack machine instructions, with a forth-inspired word definition mechanism. Forth is : forth stacks blocks words ; (little in-joke there). It doesn’t even have an address/return stack!

                                                                                                                              1. 2

                                                                                                                                It’s annoying that Elixir or Erlang languages are only good for writing web applications. You can’t write CLI tools as starting the BEAM doesn’t make sense for it. Unless I’m mistaken.

                                                                                                                                With Go for example, you can write the same highly concurrent web apps but also write CLIs thus use one language for everything + Go LSP is more mature.

                                                                                                                                I never tried out Elixir/Gleam though, perhaps its functional & expressive features are really that good.

                                                                                                                                1. 9

                                                                                                                                  You can write command line applications in Erlang based languages, it’ll just be a bit slower to start and harder to distribute than a language that complies to binary, similar to tools written in Ruby, etc.

                                                                                                                                  I wouldn’t pick Erlang for a general purpose CLI but I might for a tool for a larger Erlang project. This is a common approach: iex, mix, rebar3, rabbitmq CLI, etc.

                                                                                                                                  Go does a great job of making easy to distribute binaries, but sadly it is lacking many of the concurrency and durability features of Erlang. Ideally there would be a language with both! I’m hoping Lumen, the LLVM compiler for Erlang, will deliver here in future.

                                                                                                                                  1. 7

                                                                                                                                    (On a second read of your comment, I can’t tell if you have experience in the Erlang world. If you do, my apologies if you already know what I’ve written below. I’m learning about a new topic and I’m some what excited.)

                                                                                                                                    I have been messing around with Elixir for a few weeks and I love the pattern matching, function overloading, and expression oriented syntax. It’s a very fun, expressive language. I would recommend checking it out!

                                                                                                                                    I believe that there are some frameworks to make TUIs, but it is probably not suitable for short lived command line tools. Specifically, I understand that it is not very fast when it comes to text processing.

                                                                                                                                    One important thing to note about the erlang virtual machine (BEAM) is that it is built for low and consistent latency. You could run an infinite, cpu bound loop in one process and the rest of the processes would keep chugging along. This means that it is not necessarily built for high throughput. (The runtime interrupts each process after a certain number of “reductions”.)

                                                                                                                                    So while Go might be able to build highly concurrent systems I think you would have to put a lot of work into making the latency consistent and to build fault tolerance into your application. That said, throughput is more important than responsiveness for some applications so it is a reasonable trade-off to make.

                                                                                                                                    1. 6

                                                                                                                                      Use escript. It doesn’t start OTP which is where the startup time is spent. Starting escript is pretty much instantaneous. If you need distribution access you can still call net_kernel:start/2 manually and send messages to other instances.

                                                                                                                                      http://erlang.org/doc/man/escript.html

                                                                                                                                      1. 5

                                                                                                                                        As a follow up to my previous reply (https://lobste.rs/s/q66slp/v0_10_gleam_statically_typed_language_for#c_upesnz) I would like to say that I’ve been thinking about how Go could be a complication target for Gleam. I keep hitting into problems of not being able to replicate some Erlang features using the Go concurrency primitives (namely monitors, process isolation, and links). If you or anyone has an idea of how we could tackle this I’d love to explore this area!

                                                                                                                                        1. 1

                                                                                                                                          Go LSP

                                                                                                                                          LSP?

                                                                                                                                          1. 1

                                                                                                                                            Language server protocol. It’s a common API for IDE engines so that one program can be made per language and then shared with all editors, rather than each editor implement their own language tooling.

                                                                                                                                        1. 3

                                                                                                                                          FYI: The main Text was posted two years ago, but it has been expanded by the video series linked here.

                                                                                                                                          1. 2

                                                                                                                                            God, it’s already been two years. I should stop procrastinating and learn prolog. @_@

                                                                                                                                            1. 3

                                                                                                                                              One of the nice things of Prolog is that it is a small language, so it shouldn’t take too much time to learn. Don’t know if that helps to stop procrastinating ;).

                                                                                                                                              1. 1

                                                                                                                                                Yes, that is somewhat comforting. :)

                                                                                                                                          1. 1

                                                                                                                                            Wow they moved fast! I remember Guido van Rossum talking about PEG making pattern matching possible on a conference just last fall. I thought it’d take years :-)

                                                                                                                                            1. 1

                                                                                                                                              Why is it that the PEG parser enabled pattern matching?

                                                                                                                                              1. 3

                                                                                                                                                I don’t know exactly, but I’m guessing it has something to do with the introduction of match (and case) as new keywords even though they’re still valid identifiers in the language. PEG with its ability to backtrack arbitrarily complex expression makes it possible to recognize match as a keyword only after it parses the rest of the statement, and distinguish it from something an assignment like match[i].attr = "value".

                                                                                                                                                1. 1

                                                                                                                                                  Ah, that makes sense. Hence the use of soft keyword. I had never heard that term before.

                                                                                                                                                2. 2

                                                                                                                                                  In the link it says “The match statement uses a soft keyword, and it is one of the first major Python features to take advantage of the capabilities of the new PEG parser. This means that third-party parsers which are not ‘PEG-compatible’ will have a hard time with the new syntax.”

                                                                                                                                                  But I am still not sure about what this actually means.

                                                                                                                                              1. 2

                                                                                                                                                This could be a pretty big change! Lots of good things could come of this: CPython becomes more efficient, PyPy could have better C interop, and we could get more Python implementations.

                                                                                                                                                1. 33

                                                                                                                                                  This is starting to look like bullying. I think the post is fine, but posting it here to point and gawk isn’t. :(

                                                                                                                                                  1. 25

                                                                                                                                                    If someone makes bold claims about a project, then there’s nothing wrong with pointing out when those claims aren’t accurate.

                                                                                                                                                    1. 36

                                                                                                                                                      If we had a post for every software project that was still shit in spite of bold claims, the frontpage would be worthless.

                                                                                                                                                      1. 13

                                                                                                                                                        It’s fair to say we don’t need a post for every piece of software that isn’t living up to its claims, but that doesn’t make this bullying.

                                                                                                                                                        1. 17

                                                                                                                                                          I think there are two differences here:

                                                                                                                                                          1. @cadey wrote it but didn’t post it. I’m assuming @calvin shared it because he thought it was genuinely interesting content, not to bully V.
                                                                                                                                                          2. It’s not just that V is still shit in spite of bold claims, it’s that V is still shit in spite of bold claims and incredibly toxic behavior by its community. The interplay between all three- toxicity, grandiosity, vaporware- makes this analysis especially interesting to me.
                                                                                                                                                          1. -8

                                                                                                                                                            What toxicity are you talking about?

                                                                                                                                                            If V is vaporware then how are so many of us using it for our projects? https://github.com/vlang/v

                                                                                                                                                            Here’s a cool one: a first-person shooter game bot https://github.com/EasyHax/Vack

                                                                                                                                                            1. 16

                                                                                                                                                              What toxicity are you talking about?

                                                                                                                                                              You, in this thread, right now.

                                                                                                                                                              This is the only time I’m going to reply to you. And I only replied because nobody else has explicitly called out your hostility.

                                                                                                                                                              1. -4

                                                                                                                                                                Defending V from misleading attacks – so misleading that the author has just retracted her original post – is not exactly a defensible definition of “toxic”.

                                                                                                                                                                I don’t like seeing slander against important projects I care about. Surely you can understand!

                                                                                                                                                                1. 13

                                                                                                                                                                  All I can see here is that the V community lives up to its infamy by bullying someone into taking down a critical piece on it.

                                                                                                                                                                  1. 15

                                                                                                                                                                    I retracted the post because of people like you. It wasn’t just you, but I just wanted an end to it.

                                                                                                                                                                    1. -5

                                                                                                                                                                      If your post would have been factual then I wouldn’t have criticized it…

                                                                                                                                                                      I hope you are in a better headspace for your future posts. I’m sure many of us would love to read more articles about WasmCloud, which is honestly one of the coolest projects I’ve ever heard of; would solve many important problems at once, and do so without reinventing the wheel.

                                                                                                                                                                      (Dear readers: FWIW I didn’t ask for the post to be taken down. I was arguing against its content.)

                                                                                                                                                          2. 3

                                                                                                                                                            Did I miss some drama about this project?

                                                                                                                                                            1. 3
                                                                                                                                                            2. -3

                                                                                                                                                              Which claims aren’t accurate, specifically?

                                                                                                                                                              1. 8

                                                                                                                                                                As far as I can tell, compiling 1.2 million lines of code in a second (second bullet point). I would also like to see some citations backing up the safety guarantees with respect to C to V translation. C has way too many gotchas for a bold claim like that. Also, the safety guarantee with the C and Javascript backends.

                                                                                                                                                                1. -1

                                                                                                                                                                  You can download the project, generate 1 million lines of code using tools/gen_1mil.v and build it in 1 second with v -x64 x.v

                                                                                                                                                                  “ safety guarantee with the C backend” makes no sense, because you write the code in V, not in C. V won’t allow you globals, or shadowing etc. C can be thought of as an assembly language.

                                                                                                                                                                  1. 5

                                                                                                                                                                    If only this benchmark actually worked. First I compiled the generator using:

                                                                                                                                                                    ./v -prod cmd/tools/gen1m.v
                                                                                                                                                                    

                                                                                                                                                                    This already takes 1.3 seconds. I then ran the resulting binary as follows:

                                                                                                                                                                    ./cmd/tools/gen1m > big.v
                                                                                                                                                                    

                                                                                                                                                                    The size of the resulting file is 7.5 megabytes. I then tried to compile it as follows:

                                                                                                                                                                    ./v -prod big.v
                                                                                                                                                                    

                                                                                                                                                                    This takes 2.29 seconds, produces 7 errors, and no output binary. This is the same when using the -64 option, and also when leaving out the -prod option.

                                                                                                                                                                    Even a simple hello world takes longer than a second in production mode:

                                                                                                                                                                    v $ cat hello.v
                                                                                                                                                                    fn main() {
                                                                                                                                                                        println("Hello world")
                                                                                                                                                                    }
                                                                                                                                                                    v $ time ./v -prod hello.v
                                                                                                                                                                    
                                                                                                                                                                    ________________________________________________________
                                                                                                                                                                    Executed in    1,44 secs   fish           external
                                                                                                                                                                       usr time  1372,26 millis  350,00 micros  1371,91 millis
                                                                                                                                                                       sys time   64,93 millis   28,00 micros   64,90 millis
                                                                                                                                                                    

                                                                                                                                                                    In debug mode it already takes 600 milliseconds:

                                                                                                                                                                    v $ time ./v hello.v
                                                                                                                                                                    
                                                                                                                                                                    ________________________________________________________
                                                                                                                                                                    Executed in  666,51 millis    fish           external
                                                                                                                                                                       usr time  613,46 millis  307,00 micros  613,15 millis
                                                                                                                                                                       sys time   52,61 millis   26,00 micros   52,59 millis
                                                                                                                                                                    

                                                                                                                                                                    With -x64 a debug build takes about 2 milliseconds.

                                                                                                                                                                    Based on the above I find it hard to believe V would really be able to compile over a million lines of code in less than one second; even without optimisations enabled. I hope I am wrong here.

                                                                                                                                                                    The hardware used is as follows:

                                                                                                                                                                    • CPU: AMD Ryzen 5 1600X
                                                                                                                                                                    • RAM: 4x Kingston KHX2400C15D4/4G, a total of 16GB
                                                                                                                                                                    • SSD: Samsung 860 EVO 250GB
                                                                                                                                                            3. 13

                                                                                                                                                              maybe, but as icefox said I also feel like christine is giving V too much PR with it

                                                                                                                                                              1. 5

                                                                                                                                                                I agree that it’s unnecessary, though I can’t decide if it’s really bullying.

                                                                                                                                                                I’ve heard about V two times since the last post hit lobste.rs. One time I posted Christine’s observations, one time someone else did. I think the message is out there, and at this point, it’s really only noteworthy if something changes.

                                                                                                                                                                1. -5

                                                                                                                                                                  What message is out there? That the misleading attacks on V continue?

                                                                                                                                                                2. 5

                                                                                                                                                                  Yeah there is some interesting technical content in the post, but the tone is offputting.

                                                                                                                                                                  1. 7

                                                                                                                                                                    Abuse that gets a lot of “positive engagement” is deemed entertainment.

                                                                                                                                                                    1. 3

                                                                                                                                                                      I was amused to see it tagged “performance”, wonder if the pun was intentional on the submitter’s part.

                                                                                                                                                                    1. 0

                                                                                                                                                                      As someone who is in V’s Discord every day being constantly blown away at the progress being made, I am shocked at the level of dishonesty that this strangely anti-V hit piece achieves.

                                                                                                                                                                      In particular, the degree of cherry-picking (and often then still misrepresenting) a few facts in order to make V appear in the worst possible light is truly breathtaking.

                                                                                                                                                                      She cites vlang.io saying

                                                                                                                                                                      V can be bootstrapped in under a second by compiling its code translated to C with a simple

                                                                                                                                                                      cc v.c

                                                                                                                                                                      No libraries or dependencies needed.

                                                                                                                                                                      then argues against it, preposterously, by saying in part,

                                                                                                                                                                      Git is a dependency, which means perl is a dependency, which means a shell is a dependency, which means glibc is a dependency, which means that a lot of other things (including posix threads) are also dependencies. …

                                                                                                                                                                      Downloading a .c source file requires git? Does this person know what a “dependency” is? Should JavaScript developers include depending upon the laws of physics in package.json?

                                                                                                                                                                      Amusingly, the documentation still claims that memory management is both a work in progress and has perfect accuracy for cleaning up things at compile time.

                                                                                                                                                                      No, the documentation correctly says that memory management is a work in progress, and also that, once completed, will clean up after itself in much the way that Rust does.

                                                                                                                                                                      An Honest Depiction of Progress

                                                                                                                                                                      Here are the combined release notes from all of the V releases since December:

                                                                                                                                                                      Release 0.1.23:

                                                                                                                                                                      - [Direct x64 machine code generation](https://github.com/vlang/v/issues/2849). Hello world being built in 3 milliseconds.
                                                                                                                                                                      - Bare metal support via the `-freestanding` flag, allowing to build programs without linking to libc.
                                                                                                                                                                      - Prebuilt V packages for Linux, macOS, and Windows.
                                                                                                                                                                      - `string.index()` now returns `?int` instead of `int/-1`.
                                                                                                                                                                      - Lots of fixes in Generics.
                                                                                                                                                                      - vweb framework for developing web applications is back.
                                                                                                                                                                      - Vorum, the forum/blogging software written in V/vweb, can now be compiled and has been added to CI.
                                                                                                                                                                      - REPL, `v up` have been split up into separate applications to keep the core V compiler small.
                                                                                                                                                                      - V now enforces short enum syntax (`.green` instead of `Color.green`) when it's enough.
                                                                                                                                                                      - V UI for macOS.
                                                                                                                                                                      - Interfaces have been rewritten. `[]interface` support.
                                                                                                                                                                      - `os.cp()` for copying files and directores.
                                                                                                                                                                      - Additional compile-time flags: `$if clang, msvc, mingw, x32, x64, big_endian, little_endian {`.
                                                                                                                                                                      - All C functions now have to be declared, all missing C functions have been defined.
                                                                                                                                                                      - Global variables (only with the `--enable-globals` flag) for low level applications like kernels and drivers.
                                                                                                                                                                      - Nothing can be cast to bool (previously code like `if bool(1) {` worked.
                                                                                                                                                                      - `<<` and `>>` now work with all integer types.
                                                                                                                                                                      - V detects Cygwin and shows an error. (V supports Windows natively)
                                                                                                                                                                      - Improved type checking of some operators (`%, |, &` etc).
                                                                                                                                                                      - Windows 7 support.
                                                                                                                                                                      - `println(true)` now prints `true` instead of `1`.
                                                                                                                                                                      - `os.exec()` now uses `CreateProcess` on Windows.
                                                                                                                                                                      - fast.vlang.io website for monitoring the performance of V after every commit.
                                                                                                                                                                      - On Windows Visual Studio is now used automatically if GCC is not installed.
                                                                                                                                                                      - vfmt!
                                                                                                                                                                      - Lots of cleaning up in the compiler code.
                                                                                                                                                                      - Multi-level pointers in unsafe code (`****int`).
                                                                                                                                                                      - MSVC backtrace.
                                                                                                                                                                      - `$if os {` blocks are now skipped on a different OS.
                                                                                                                                                                      - C string literals (`c'hello'`).
                                                                                                                                                                      - AlpineLinux/musl fixes + added to CI.
                                                                                                                                                                      - Inline assembly.
                                                                                                                                                                      - Clipboard module (Windows, macOS, X).
                                                                                                                                                                      - `foo()?` syntax for error propagation.
                                                                                                                                                                      - Docs have been migrated from HTML to `doc/docs.md`.
                                                                                                                                                                      - `eventbus` module.
                                                                                                                                                                      - Haiku OS support.
                                                                                                                                                                      - `malloc/free` on bare metal.
                                                                                                                                                                      - `utf8` helper functions (`to_lower()`, `to_upper()`, etc).
                                                                                                                                                                      - Optimization of `for c in str {`.
                                                                                                                                                                      - `string/array.left/right/slice/substr` were removed (`[a..b]` slicing syntax should be used instead).
                                                                                                                                                                      

                                                                                                                                                                      Release 0.1.24:

                                                                                                                                                                      - A new parser/generator built on top of an AST that simplifies code greatly and allows to implement new
                                                                                                                                                                        backends much faster.
                                                                                                                                                                      - Sum types (`type Expr = IfExpr | MatchExpr | IntegerLiteral`).
                                                                                                                                                                      - B-tree map (sped up the V compiler by ~10%).
                                                                                                                                                                      - `v fmt -w`.
                                                                                                                                                                      - The entire code base has been formatted with vfmt.
                                                                                                                                                                      - Generic structs.
                                                                                                                                                                      - SDL module.
                                                                                                                                                                      - Arrays of pointers.
                                                                                                                                                                      - os: `is_link()`, `is_dir()`, `exists()`.
                                                                                                                                                                      - Ranging through fixed size arrays.
                                                                                                                                                                      - Lots of fixes in ORM and vweb.
                                                                                                                                                                      - The first tutorial: [building a simple web application with vweb](https://github.com/vlang/v/blob/master/tutorials/building-a-simple-web-blog-with-vweb.md).
                                                                                                                                                                      - Match expressions now must be exhaustive.
                                                                                                                                                                      - freestanding: `malloc()`/`free()`.
                                                                                                                                                                      - `++` is now required instead of `+= 1` for consistency.
                                                                                                                                                                      - Interpolated strings now allow function calls: `println('val = $get_val()')`.
                                                                                                                                                                      - `string.replace_each([])` for an efficient replacement of multiple values.
                                                                                                                                                                      - More utf8 helper functions.
                                                                                                                                                                      - `-prealloc` option for block allocations.
                                                                                                                                                                      - `type` aliases.
                                                                                                                                                                      - Running `v` with an unknown command will result in an error.
                                                                                                                                                                      - `atof` implementation in pure V.
                                                                                                                                                                      - Enums can now have negative values.
                                                                                                                                                                      - New `filepath` module.
                                                                                                                                                                      - `math.factorial`.
                                                                                                                                                                      - `ftp` module.
                                                                                                                                                                      - New syntax for casting: `val as Type`.
                                                                                                                                                                      - Fewer libc functions used (soon V will have no dependency on libc).
                                                                                                                                                                      

                                                                                                                                                                      Release 0.1.27:

                                                                                                                                                                      - `vfmt` has been re-written from scratch using the new AST parser. It's much faster, cleaner, and can format
                                                                                                                                                                      files with compilation errors.
                                                                                                                                                                      - `strconv`, `sprintf`, and `printf` in native V, without any libc calls.
                                                                                                                                                                      - Interfaces are now a lot more stable and have all expected features.
                                                                                                                                                                      - Lots of x64 backend improvements: function calls, if expressions, for loops, local variables.
                                                                                                                                                                      - `map()` and `filter()` methods can now be chained.
                                                                                                                                                                      - New `[]int{cap:cap, len:len}` syntax for initializing array length and capacity.
                                                                                                                                                                      - New `is` keyword for checking the type of sum types and interfaces.
                                                                                                                                                                      - `as` can now be used to cast interfaces and sum types.
                                                                                                                                                                      - Profiling with `-profile`. Prints a nice table with detailed information about every single function call:
                                                                                                                                                                      number of calls, average time per call, total time per function.
                                                                                                                                                                      - `import(xxx)` syntax has been removed in favor of `import xxx` for simplicity and greppability.
                                                                                                                                                                      - Lots of fixes and improvements in the type checker.
                                                                                                                                                                      - `time.StopWatch`
                                                                                                                                                                      - `dl` module for dynamic loading.
                                                                                                                                                                      - Automatic `str()` method generation for every single type, including all arrays and fixed size arrays.
                                                                                                                                                                      - Short struct initialization syntax for imitating named function args: `foo(bar:0, baz:1)`.
                                                                                                                                                                      - New operator `!in`.
                                                                                                                                                                      - Performance improvements in critical parts of the builtin data structures (array, map).
                                                                                                                                                                      - High order functions improvements (functions can now be returned etc).
                                                                                                                                                                      - Anonymous functions that can be defined inside other functions.
                                                                                                                                                                      - Built-in JSON module is back.
                                                                                                                                                                      - Closures.
                                                                                                                                                                      - Lots and lots of new tests added, including output tests that test error messages.
                                                                                                                                                                      - Multiple errors are now printed, the compiler no longer stops after the first error.
                                                                                                                                                                      - The new JS backend using the AST parser (almost complete).
                                                                                                                                                                      - Variadic functions.
                                                                                                                                                                      - `net.websocket` module (early stage).
                                                                                                                                                                      - `vlib` is now memory leak free, lots of `autofree` improvements.
                                                                                                                                                                      - Simplified and cleaned up `cmd/v`, `v.builder`.
                                                                                                                                                                      - V UI was updated to work with the new backend.
                                                                                                                                                                      

                                                                                                                                                                      After she COMPLETELY ignores the MASSIVE progress mademore than 3000 commits worth from a brilliant and fiercely dedicated team – and judges the current state of V based exclusively on misunderstandings, nitpicks, and on its memory management status after acknowledging that it’s not done yet and that the language is in an alpha state, she snarkily ends with:

                                                                                                                                                                      Overall, V looks like it is making about as much progress as I had figured it would.

                                                                                                                                                                      This is almost as bad as the quote she ended with in her previous post on V:

                                                                                                                                                                      Don’t ever, ever try to lie to the Internet, because they will catch you. …


                                                                                                                                                                      Honesty, Please!

                                                                                                                                                                      If you want to know how well V is actually progressing, try it yourself, check out the Discord, look on GitHub, but whatever you do, do not focus on ignorant, dishonest, cherry-picked commentary from haters; that doesn’t serve anyone well, and is incredibly unfair to those who are pouring themselves into this important project.


                                                                                                                                                                      The Brilliance of V

                                                                                                                                                                      After my 11 years of programming, including 9.5 of programming in Go (which is the most similar language to V), I consider V to easily be the best-designed programming language that exists.

                                                                                                                                                                      Yes, it’s learned a lot from Go and C, and maybe Lisp people prefer Lisp, but V successfully combines the simplicity of Go, the programmer ergonomics of Python, the speed C, and almost as many safety guarantees as Rust (once V has finished implementing these latter aspects, of course!).

                                                                                                                                                                      What I thought would take the V team 5 years to implement has taken less than 1 year. Alex (V’s creator) thought it would take even less time, and now he’s being unfairly raked over the coals for setting extremely ambitious timelines while the same naysayers and bullies ignore everything that has been done.


                                                                                                                                                                      V Resources

                                                                                                                                                                      Website (including code examples): https://vlang.io/

                                                                                                                                                                      GitHub: https://github.com/vlang/v

                                                                                                                                                                      Wiki page explaining why C is used as in intermediate representation rather than LLVM (another brilliant move that allows V to build on the shoulders of giants and avoid reinventing the wheel in order to bootstrap a new language, but a move that is misunderstood and absurdly used to argue against V for doing things differently/better): https://github.com/vlang/v/wiki/On-the-benefits-of-using-C-as-a-language-backend

                                                                                                                                                                      1. 25

                                                                                                                                                                        I understand that you have strong feelings for your language of choice. Nonetheless, language designers are not entitled to a community, nor are they entitled to shelter from criticism. Indeed, one of the most important parts of programming language design is rejecting new languages based on showstoppingly-unacceptable design choices.

                                                                                                                                                                        V does not offer any compelling design choices. Its advertised features can be sorted into libraries, compiler/toolchain offerings, and roughly the level of safety advertised in the 80s when memory-safety was still controversial. Just like Go, V has not learned many lessons, and refuses to offer programmers a more interesting way to express themselves. Even if V were literally Go but better, this would be sufficient to damn it.

                                                                                                                                                                        I understand that you might not like it when people point out that the release dates keep slipping; I think it’s curious that you are willing to link to V’s wiki and source code, but not to bumping release dates.

                                                                                                                                                                        As a language designer, I think that it is important to not advertise what you don’t yet have written. Monte has had one release, a developer preview, and we are intending to complete another iteration of bootstrapping before even considering another release. We know that almost every feature that typical end users will want is not yet written, and so we are not loudly advertising our offering as usable for everyday general-purpose programming, regardless of how much everyday general-purpose programming I or anybody else actually achieves with it.

                                                                                                                                                                        I consider V to easily be the best-designed programming language that exists.

                                                                                                                                                                        What’s your favorite ML? I have lately played with OCaml. There are entire universes of language designs which I suspect that you have yet to explore.

                                                                                                                                                                        1. -4

                                                                                                                                                                          Just like Go, V has not learned many lessons, and refuses to offer programmers a more interesting way to express themselves.

                                                                                                                                                                          FP diehards will never understand why Go has been so wildly successful – and V will be even more successful than Go.

                                                                                                                                                                          V is like Go but fixes all ~10 things wrong with it, providing a lot more flexibility due to its generic functions, generic structs, generic channels (still in the works), sum types, and TypeScript-style interfaces (also still partially in the works).

                                                                                                                                                                          Plus there’s the raw speed factor; V is translated to C before being compiled to machine code, cleverly piggybacking on decades of speed optimizations made by gcc/clang/tcc/etc.

                                                                                                                                                                          The simplicity of Go or Python + almost as much safety as Rust + almost exactly as much speed as C + a flexible type system + familiar syntax == a winning combination, I insist!

                                                                                                                                                                          1. 16

                                                                                                                                                                            The simplicity of Go or Python + almost as much safety as Rust + almost exactly as much speed as C + a flexible type system + familiar syntax == a winning combination, I insist!

                                                                                                                                                                            Except all of these are “some time in the future”, and widely incompatible with one another. There’s nothing to support any of these claims. What’s the design for “almost as much safety as rust” (without GC, of course)? The whole thing only just got an AST, and we’re supposed to believe it’s going to be revolutionary? There’s been a lot of grand promises with release dates being pushed back repeatedly, but nothing specific about how the promises will actually be achieved. Making a good language is hard, it takes years (if not decades), and you can’t just magically make something both simple, fast, safe, gc-free, etc. in a field where it’s known that some tradeoffs are inevitable.

                                                                                                                                                                            1. -3

                                                                                                                                                                              Except all of these are “some time in the future”, and widely incompatible with one another.

                                                                                                                                                                              Nope, totally wrong. The simplicity is there, the speed is there, the flexible type system is there, and the familiar syntax is there. A safe subset of C is generated then compiled but not all the safety guarantees are implemented yet.

                                                                                                                                                                              There’s been a lot of grand promises with release dates being pushed back repeatedly

                                                                                                                                                                              V is the first software project in history to be finished later than originally intended ;-).

                                                                                                                                                                              The whole thing only just got an AST

                                                                                                                                                                              Completely false; V has always had an AST. The AST-related thing that’s new is representing the generated C code as an AST before outputting it.

                                                                                                                                                                              … you can’t just magically make something both simple, fast, safe, gc-free, etc. in a field where it’s known that some tradeoffs are inevitable.

                                                                                                                                                                              The big “a-ha” moment for me was this: I now realize that I had falsely assumed that just because prior languages took certain trade-offs that it was impossible to check all these boxes at once. But I was wrong.

                                                                                                                                                                              The only inherent tension between any of the things I listed is between simplicity and flexibility. But as I said in the comment you’re replying to,

                                                                                                                                                                              V is like Go but fixes all ~10 things wrong with it, providing a lot more flexibility due to its generic functions, generic structs, generic channels (still in the works), sum types, and TypeScript-style interfaces (also still partially in the works).

                                                                                                                                                                              The limiting factor is not some innate impossibility of making a language that is simple, fast, and safe. The limiting factor is creativity. But V has learned much from Go, Rust, Python, and other languages, and has unique insights of its own (like its error handling!).

                                                                                                                                                                              New things are, in fact, possible… and spelled out in detail on the website and in the docs, in this case. See for yourself: https://github.com/vlang/v/blob/master/doc/docs.md .

                                                                                                                                                                              1. 9

                                                                                                                                                                                the flexible type system is there

                                                                                                                                                                                hydraz below convincingly demonstrated that if function calls have generic types, type is not checked at all(!) in current V. How can you say type system is “there”? I guess it is “there” in terms of code generation, but if you are not checking types, saying type system is there is at best deceptive.

                                                                                                                                                                                1. -4

                                                                                                                                                                                  How can you say type system is “there”?

                                                                                                                                                                                  …because there are types you can define and instantiate and do all the usual things that programming languages let you do with types…

                                                                                                                                                                                  hydraz said,

                                                                                                                                                                                  type errors for parameters in functions with a slapped on them are still silently ignored…

                                                                                                                                                                                  Silently ignored? If you use a generic type in a way that’s invalid then the program won’t compile (yes, during the C -> machine code step).

                                                                                                                                                                                  1. 9

                                                                                                                                                                                    I think you need to read my comments - and indeed, the compiler code that I linked - again. V has roughly no type system at all. The function, foo, that I wrote, isn’t generic!

                                                                                                                                                                                    • It does have a <T>, but there’s nothing to infer that T from (This should be a type error. It isn’t)
                                                                                                                                                                                    • It takes a string, but I can give it an int, and this should be an error, but the compiler has code specifically for silently ignoring these errors.
                                                                                                                                                                                2. 8

                                                                                                                                                                                  spelled out in detail

                                                                                                                                                                                  Let’s see memory management: there’s no explanation, just claims there are (or will be, it’s wip after all) no leaks, no gc, not refcounting, but also no manual memory management (it’s hardly leak free, after all, even in rust). What magic justifies that? Is there just no dynamic allocation? Otherwise I’d like to see the papers and subsequent Turing award for solving memory management once and for all.

                                                                                                                                                                                  As for the deadlines: the author of V has made ridiculous deadlines so many times, for no good reason (why promise something in a few weeks or months instead of just waiting for it to be polished?!). It’s not like open source projects are tied to pointy haired boss deadlines.

                                                                                                                                                                              2. 13

                                                                                                                                                                                Interestingly, I’m not an “FP diehard”; I come from an object-based tribe, and I work on object-based designs.

                                                                                                                                                                                None of the listed improvements to V over Go are related to what makes Go bad; I have a thread from last year exploring the worst of Go’s flaws. In short, the problem isn’t even an upper limit on abilities, but a lower limit on how much code is required to do even the bare minimum, and a surprising lack of safety in common situations.

                                                                                                                                                                                As the original post author and several others have repeatedly indicated throughout current and past discussion about V, the speed claims simply aren’t being substantiated in an open and reproducible configuration which the community can examine and test themselves. Simply changing the host language does not grant speed, unfortunately, because of interpretative overhead, and the only cure is putting effort into the compiler.

                                                                                                                                                                                At the same time, it is toolchains and not languages that are fast, and so any novel speed improvements in V should be explicable to the rest of us. For example, in Monte, we use nanopass design and ANF style, originally explored in Scheme. We have a JIT in the Smalltalk/Java tradition, using an off-the-shelf toolkit, RPython.

                                                                                                                                                                                As an aside, I would imagine that V would be able to more efficiently take advantage of GCC/LLVM/etc. by picking just one backend, and emitting code just for that backend. This would be due to C’s relatively poor guarantees about how memory will be used.

                                                                                                                                                                                1. 5

                                                                                                                                                                                  V is translated to C before being compiled to machine code

                                                                                                                                                                                  That, right there, is enough for me to question any safety guarantee V offers (and I like C).

                                                                                                                                                                                  1. 4

                                                                                                                                                                                    Nim compiles to C and it’s garbage collected. I believe the reasons they do that are runtime reach and whole program optimization.

                                                                                                                                                                                    If you can statically guarantee safety it shouldn’t be a problem. (However, its not necessarily a trivial thing to suggest.)

                                                                                                                                                                                    1. 3

                                                                                                                                                                                      ATS compiles to C too, if I understand it correctly. And there have been Haskell compilers that compiled to C too and many other programming languages that provide some aspects of safety that the underlying C language, like the machine code, do not provide.

                                                                                                                                                                                      1. 4

                                                                                                                                                                                        Why does using C as an intermediate language in the compilation process necessarily imply that a language’s safety guarantees are bad? Compilers that compile to some kind of bytecode - like rustc compiling to LLVM bitcode, or JVM langauges’ compilers compiling to JVM bytecode - are perfectly capable of being safe, even though they output code in an unsafe language (which may or may not be the final compilation output - it is (I think) in the JVM case, but LLVM bitcode is further transformed into machine-specific machine code). I don’t see why C should be any different in this respect.

                                                                                                                                                                                        1. 3

                                                                                                                                                                                          I don’t know the guarantees of LLVM or JVM, but at the language level, C has a ton of unspecified and undefined behaviors. Skipping the dangers around pointers and arrays, you still have the following undefined behavior as outlined in the C standard:

                                                                                                                                                                                          • shifting an integer by a negative value
                                                                                                                                                                                          • shifting an integer more than its size in bits
                                                                                                                                                                                          • left shifting a negative value
                                                                                                                                                                                          • signed integer representation (sign-magnitude, 1s complement, 2s complement [1])
                                                                                                                                                                                          • (quoting from the C99 standard for this one): Whether certain operators can generate negative zeros and whether a negative zero becomes a normal zero when stored in an object
                                                                                                                                                                                          • signed integer trap representations
                                                                                                                                                                                          • signed integer wrap sematics
                                                                                                                                                                                          • padding value
                                                                                                                                                                                          • padding in general
                                                                                                                                                                                          • reading a union member that wasn’t the last one written to

                                                                                                                                                                                          Now, it seems that V is targeting GCC/clang, but even so, you’ll get differences in behavior across different architectures, specifically with shifting (some architectures will mask the shift count, some won’t). When I see “safety” as applied to a computer language, I would expect these issues will be spelled out as to what to expect.

                                                                                                                                                                                          [1] In my research, there aren’t many systems in use today that are not 2s complement. They are:

                                                                                                                                                                                          • Unisys 1100/2200
                                                                                                                                                                                          • Unisys ClearPath A
                                                                                                                                                                                          • IBM 700/7000 series

                                                                                                                                                                                          I know one of the Unisys systems is still be produced today and has a C compiler (which one, I don’t recall, I think the 1100/2200).

                                                                                                                                                                                          1. 2

                                                                                                                                                                                            you do realize that source code gets compiled to machine code, which is not safe by definition.

                                                                                                                                                                                            The generated C code doesn’t use any of these, and doesn’t have to.

                                                                                                                                                                                            1. 3

                                                                                                                                                                                              Then what’s your definition of “safe” then? There is way less that’s undefined in assembly than in C. Give me an architecture, and I can look up what it does for the above list. The reason C has so much undefined behavior is precisely because it runs on many architectures and the designers of C didn’t want to favor one over the other. Different languages can make different trade offs .

                                                                                                                                                                                      2. 5

                                                                                                                                                                                        FP diehards will never understand why Go has been so wildly successful – and V will be even more successful than Go.

                                                                                                                                                                                        Do you? Go succeeded because it was created and backed by veteran Bell Labs people and Google, to solve existing problems. I’m not talking about marketing only, but also the level of sophistication and simplicity those people were able to bring in.

                                                                                                                                                                                        It also succeeded because it didn’t promise anything it didn’t deliver.

                                                                                                                                                                                        1. -4

                                                                                                                                                                                          Yes. I spotted Go as great technology in November of 2010. Go is simple and fairly powerful considering that simplicity.

                                                                                                                                                                                          The original version of V was written in Go, V has learned many lessons from Go, both from its strengths that V builds on and the weaknesses it shores up with generic functions, generic structs, sum types, and more.

                                                                                                                                                                                    2. 14

                                                                                                                                                                                      I’d be interested in seeing what kind of these “lots of fixes in Generics are”, because as far as I can tell from reading the compiler source code, type errors for parameters in functions with a <T> slapped on them are still silently ignored…

                                                                                                                                                                                        if !c.check_types(typ, arg.typ) {
                                                                                                                                                                                          // str method, allow type with str method if fn arg is string
                                                                                                                                                                                          if arg_typ_sym.kind == .string && typ_sym.has_method('str') {
                                                                                                                                                                                            // note: str method can return anything. will just explode in the C compiler -- hydraz
                                                                                                                                                                                            continue
                                                                                                                                                                                          }
                                                                                                                                                                                          if typ_sym.kind == .void && arg_typ_sym.kind == .string {
                                                                                                                                                                                            continue
                                                                                                                                                                                          }
                                                                                                                                                                                          if f.is_generic {
                                                                                                                                                                                            // ignore errors in functions with a <T> -- hydraz
                                                                                                                                                                                            continue
                                                                                                                                                                                          }
                                                                                                                                                                                          if typ_sym.kind == .array_fixed {
                                                                                                                                                                                          }
                                                                                                                                                                                      

                                                                                                                                                                                      Try this code:

                                                                                                                                                                                      fn  foo<T>(y string) int {
                                                                                                                                                                                        return 0
                                                                                                                                                                                      }
                                                                                                                                                                                      
                                                                                                                                                                                      fn main() {
                                                                                                                                                                                        foo(123)
                                                                                                                                                                                      }
                                                                                                                                                                                      
                                                                                                                                                                                      1. -4

                                                                                                                                                                                        You had foo take a string then passed in an int :-)

                                                                                                                                                                                        EDIT: This works, for example:

                                                                                                                                                                                        fn foo<T>(y string) int {
                                                                                                                                                                                          return 0
                                                                                                                                                                                        }
                                                                                                                                                                                        
                                                                                                                                                                                        fn main() {
                                                                                                                                                                                          println(foo<int>('hi'))
                                                                                                                                                                                        }
                                                                                                                                                                                        
                                                                                                                                                                                        1. 22

                                                                                                                                                                                          … Yes, that’s my point. I passed an int to a string parameter, and the V compiler didn’t give a type error: the C compiler did.

                                                                                                                                                                                          % make
                                                                                                                                                                                          cd ./vc && git clean -xf && git pull --quiet
                                                                                                                                                                                          cd /var/tmp/tcc && git clean -xf && git pull --quiet
                                                                                                                                                                                          cc  -g -std=gnu11 -w -o v ./vc/v.c  -lm -lpthread
                                                                                                                                                                                          ./v self
                                                                                                                                                                                          V self compiling ...
                                                                                                                                                                                          make modules
                                                                                                                                                                                          make[1]: Entering directory '/home/abby/Projects/v'
                                                                                                                                                                                          #./v build module vlib/builtin > /dev/null
                                                                                                                                                                                          #./v build module vlib/strings > /dev/null
                                                                                                                                                                                          #./v build module vlib/strconv > /dev/null
                                                                                                                                                                                          make[1]: Leaving directory '/home/abby/Projects/v'
                                                                                                                                                                                          V has been successfully built
                                                                                                                                                                                          V 0.1.27 b806fff
                                                                                                                                                                                          
                                                                                                                                                                                          % ./v test.v
                                                                                                                                                                                          ==================
                                                                                                                                                                                          /home/abby/.cache/v/test.tmp.c: In function ‘main’:
                                                                                                                                                                                          /home/abby/.cache/v/test.tmp.c:9476:2: error: implicit declaration of function ‘foo’ [-Werror=implicit-function-declaration]
                                                                                                                                                                                           9476 |  foo(123);
                                                                                                                                                                                                |  ^~~
                                                                                                                                                                                          /home/abby/.cache/v/test.tmp.c: In function ‘vcalloc’:
                                                                                                                                                                                          /home/abby/.cache/v/test.tmp.c:4597:1: warning: control reaches end of non-void function [-Wreturn-type]
                                                                                                                                                                                           4597 | }
                                                                                                                                                                                                | ^
                                                                                                                                                                                          /home/abby/.cache/v/test.tmp.c: In function ‘byte_is_white’:
                                                                                                                                                                                          /home/abby/.cache/v/test.tmp.c:7227:1: warning: control reaches end of non-void function [-Wreturn-type]
                                                                                                                                                                                           7227 | }
                                                                                                                                                                                                | ^
                                                                                                                                                                                          ...
                                                                                                                                                                                          ==================
                                                                                                                                                                                          (Use `v -cg` to print the entire error message)
                                                                                                                                                                                          
                                                                                                                                                                                          builder error: 
                                                                                                                                                                                          ==================
                                                                                                                                                                                          C error. This should never happen.
                                                                                                                                                                                          
                                                                                                                                                                                      2. 17

                                                                                                                                                                                        Author of the post here, let me see if I can try to clear some things up.

                                                                                                                                                                                        She cites vlang.io saying

                                                                                                                                                                                        V can be bootstrapped in under a second by compiling its code translated to C with a simple

                                                                                                                                                                                        cc v.c

                                                                                                                                                                                        No libraries or dependencies needed.

                                                                                                                                                                                        then argues against it, preposterously, by saying in part,

                                                                                                                                                                                        Git is a dependency, which means perl is a dependency, which means a shell is a dependency, which means glibc is a dependency, which means that a lot of other things (including posix threads) are also dependencies. …

                                                                                                                                                                                        Downloading a .c source file requires git? Does this person know what a “dependency” is? Should JavaScript developers include depending upon the laws of physics in package.json?

                                                                                                                                                                                        Okay I was being a bit unfair, but if we look at the makefile we see that it has the following dependencies:

                                                                                                                                                                                        • make (which depends on perl, glibc, autotools and all that nonsense)
                                                                                                                                                                                        • git (which depends on perl (even at runtime), glibc, autotools and all that nonsense)
                                                                                                                                                                                        • gcc (which depends on perl, glibc, autotools, automake, autoconf and more libraries than I care to list right now)

                                                                                                                                                                                        So if you want to be completely honest, even if you cut out the make and git steps (which i care about as someone who builds packages for linux boxes using the unmodified build system as much as possible so I can maintain whatever shred of sanity I have left), it still depends on a C compiler to get bootstrapped. This is a dependency. Then you have to download the bootstrap file from somewhere, which requires dependencies in terms of root certificates and the compiler to bootstrap with (not to mention the server that hosts the bootstrap file both existing and serving the right file back). Given that V in its current form requires you to download files from the internet in order to build it, mathematically it cannot be dependency free (this actually precludes it from being packageable in NixOS, because NixOS doesn’t allow package builds to access the network, all of the tarball/assets need to be explicitly fetched outside the build with fetchgit, fetchurl and similar). Pedantically, requiring someone to have an internet connection is a dependency.

                                                                                                                                                                                        Pedantically, the v binary lists the following dynamically linked dependencies when using lld(1):

                                                                                                                                                                                        $ ldd ./v
                                                                                                                                                                                                linux-vdso.so.1 (0x00007fff2d044000)
                                                                                                                                                                                                libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f2fb3e4c000)
                                                                                                                                                                                                libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2fb3a5b000)
                                                                                                                                                                                                /lib64/ld-linux-x86-64.so.2 (0x00007f2fb4345000)
                                                                                                                                                                                        

                                                                                                                                                                                        If the binary was truly dependency-free, the ldd output would look something like this:

                                                                                                                                                                                        $ ldd $HOME/bin/dhall
                                                                                                                                                                                                not a dynamic executable
                                                                                                                                                                                        

                                                                                                                                                                                        This leads me to assume that the v binary has dependencies that the runtime system will need to provide, otherwise the program will not be able to be loaded by the Linux kernel and executed. Binaries produced by v have similar limitations:

                                                                                                                                                                                        $ ldd ./hello
                                                                                                                                                                                                linux-vdso.so.1 (0x00007ffdfdff2000)
                                                                                                                                                                                                libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fed25771000)
                                                                                                                                                                                                /lib64/ld-linux-x86-64.so.2 (0x00007fed25d88000)
                                                                                                                                                                                        

                                                                                                                                                                                        Additionally, I am banned from the V discord and GitHub. The V programming language has censored a neuro-diverse trans woman from being able to contribute to the project in any capacity. I would love to be able to contribute to things at least to make the documentation and website not filled with misleading statements, but I cannot. This is why I ask other people to make issues for me in my posts.

                                                                                                                                                                                        I realize things might look snarky when the article is viewed from a certain worldview/lens, but there is a total scalar lack of snark intended in that article when it was written. If you cannot realize that, then I am sorry that my intended tone didn’t have the effect I wanted and I will use this feedback to further refine my writing ability.

                                                                                                                                                                                        Direct x64 machine code generation

                                                                                                                                                                                        In my testing I was unable to get this working on my Ubuntu server. It still used gcc.

                                                                                                                                                                                        1. 8

                                                                                                                                                                                          You ended your piece (which utterly trashes V) by saying

                                                                                                                                                                                          Overall, V looks like it is making about as much progress as I had figured it would.

                                                                                                                                                                                          I criticized your snark, and you replied with

                                                                                                                                                                                          I realize things might look snarky when the article is viewed from a certain worldview/lens, but there is a total scalar lack of snark intended in that article when it was written.

                                                                                                                                                                                          Do you really expect anyone to believe that?

                                                                                                                                                                                          Additionally, I am banned from the V discord and GitHub. The V programming language has censored a neuro-diverse trans woman from being able to contribute to the project in any capacity.

                                                                                                                                                                                          Do you really think that’s why you were banned? Does Alex even know you’re trans? You don’t think you were banned for your vicious and misleading attacks on this project?

                                                                                                                                                                                          1. 5

                                                                                                                                                                                            You’re just ignoring the points she made here, and keep talking besides her and banging on about the article.

                                                                                                                                                                                            1. 6

                                                                                                                                                                                              @cadey didn’t say they were banned for who they are, they just stated they were X and were banned.

                                                                                                                                                                                              You don’t think you were banned for your vicious and misleading attacks on this project?

                                                                                                                                                                                              If my memory serves me right, @cadey was banned because of their disagreements with V, such as those voiced in this and the previous (https://christine.website/blog/v-vvork-in-progress-2020-01-03) blog post. I could be wrong. Also “vicious” is being overly dramatic and frankly not productive.

                                                                                                                                                                                              1. 4

                                                                                                                                                                                                @cadey didn’t say they were banned for who they are, they just stated they were X and were banned.

                                                                                                                                                                                                Then why bring it up?

                                                                                                                                                                                                If my memory serves me right, @cadey was banned because of their disagreements with V, … . I could be wrong.

                                                                                                                                                                                                Is that actually true?

                                                                                                                                                                                                Also “vicious” is being overly dramatic …

                                                                                                                                                                                                It doesn’t sound like you’re paying very close attention… Two other people criticized her for bullying in this very thread before I even got here. If you read my comments here then I’d hope you would change your mind about how unfairly harsh she has been to Alex, to his project, and to the V team.

                                                                                                                                                                                                Consider starting here: https://lobste.rs/s/nfjifq/v_update_june_2020#c_vuofat

                                                                                                                                                                                                1. 22

                                                                                                                                                                                                  You almost never comment except in V threads.

                                                                                                                                                                                                  Further, many of those comments seem to be today, in last year’s thread.

                                                                                                                                                                                                  Please just let this be. Flag the submission if you must and move on.

                                                                                                                                                                                                  1. 6

                                                                                                                                                                                                    I have removed the post as of this commit. In a few minutes the article will be gone, but a tombstone of the former article will remain.

                                                                                                                                                                                                    1. 19

                                                                                                                                                                                                      I don’t think you did anything wrong by posting it, I don’t think you made any mistakes, and I enjoyed reading it. Not saying this to convince you to put the essay back; I just know that I personally feel awful when I get really harsh criticism, even when I don’t respect or care about the person giving it. So wanted to provide a bit of positivity to balance it out ツ

                                                                                                                                                                                                    2. 8

                                                                                                                                                                                                      Then why bring it up?

                                                                                                                                                                                                      I can’t answer that question. While I’m not sure what the benefit is of bringing it up, I don’t see the harm either; it was pretty clear from the comment they were not saying they were banned because of who they are.

                                                                                                                                                                                                      Is that actually true?

                                                                                                                                                                                                      Feel free to show otherwise. I can’t, because I’m not the person who banned @cadey; nor am I in contact with them.

                                                                                                                                                                                                      It doesn’t sound like you’re paying very close attention

                                                                                                                                                                                                      Please do not make such assumptions. It’s unproductive starting an argument as such, as well as factually incorrect.

                                                                                                                                                                                                      Two other people criticized her for bullying in this very thread before I even got here.

                                                                                                                                                                                                      Only one person said it’s starting to look like bullying (https://lobste.rs/s/nfjifq/v_update_june_2020#c_cdxvwk). Other comments mentioning “bullying” either state they are not sure, or don’t see it as bullying. I don’t see anybody else mentioning this is bullying. Am I perhaps overlooking something?

                                                                                                                                                                                                      If you read my comments here then I’d hope you would change your mind about how unfairly harsh she has been to Alex, to his project, and to the V team.

                                                                                                                                                                                                      I agree the tone in the blog post is not the most productive. While some parts of the post are a bit pedantic, overall I think it’s not unfairly harsh. V made many big claims both before and after its release. Here are just a few examples:

                                                                                                                                                                                                      • https://github.com/vlang/v/issues/35
                                                                                                                                                                                                      • Translating C++ to V, which now has the note “TODO: translating C to V will be available in V 0.3. C++ to V will be available later this year.”
                                                                                                                                                                                                      • Claiming V has pure functions when they can still have side-effects. “Pure” has a well defined meaning. If you mean “pure but with IO”, then call it something else; otherwise it’s just misleading. This was brought up in this issue, which was closed, but I can’t find any mention of this in the docs here.
                                                                                                                                                                                                      • Various claims about certain components not having dependencies, only to have dependencies; despite the website advertising “Compiles to native binaries without any dependencies”
                                                                                                                                                                                                      • Advertising “V is written in V and compiles itself in under a second.”, when according to https://fast.vlang.io/ compiling V with optimisations (if I’m reading the table correctly) takes over one second most of the time.

                                                                                                                                                                                                      There is a lot more from past discussions (e.g. those on Hacker News), so I suggest taking a look at those.

                                                                                                                                                                                                      With that all said, I really do hope V succeeds and wish the authors the best of luck. But the authors really need to make sure that what they advertise is actually implemented as advertised, or make it very clear what the current state is. Don’t go around saying “We support X” followed by “oh by the way we’ll release that end of this year”.

                                                                                                                                                                                            1. -1

                                                                                                                                                                                              Can anyone recommend some material describing concrete motivations for adding generics to Go? I’m aware of the abstract idea that you need generics in order to build data structures that work with different types, but is there a real-world setting where this is actually better than just copying code and doing s/type1/type2/g? My sense is that projects that use complex data structures almost always customize the data structures in a way that depends on the data type being stored.

                                                                                                                                                                                              1. 19

                                                                                                                                                                                                I hope it’s not that hard to imagine wanting different data structures than hash maps; maybe your problem fits better into a binary search tree for example.

                                                                                                                                                                                                Well, I for one usually don’t feel like implementing my own red-black tree, so I would like to just grab a library. That library will be much nicer to use if I can just make an RBTree<string, MyFoo>. I certainly wouldn’t want to copy/paste an int->string red-black tree into some file(s) and judiciously search/replace until I have a string->MyFoo tree (and then do the same when I need an int->float tree).

                                                                                                                                                                                                1. 0

                                                                                                                                                                                                  That makes sense, but I am still looking for some grounding in actual programming practice. Is there a use of a red-black tree that would not warrant customizing it for the storage type? Or one where it would make sense to add a library dependency rather than copying the RB tree code?

                                                                                                                                                                                                  1. 7

                                                                                                                                                                                                    How do you write a library that provides a Red-Black tree that can in principle work with many different client types without generics? This isn’t a rhetorical question, I don’t know Go and I genuinely don’t know how you would implement this kind of library in Go without generics.

                                                                                                                                                                                                    1. 6

                                                                                                                                                                                                      Go’s sync.Map (concurrent hashmap) is an actual real world example of this, and it uses interface{}, akin to Java’s Object.

                                                                                                                                                                                                      1. 24

                                                                                                                                                                                                        Right, that’s a great example. Because it uses interface{}, it:

                                                                                                                                                                                                        • Requires all keys and values to be heap allocated, leading to worse performance, worse memory usage, and worse memory fragmentation. Requiring two heap-allocated ints to store one value in an int->int concurrent hash map is unacceptable for many uses.
                                                                                                                                                                                                        • Is less ergonomic, requiring a cast every time you want to use a value.
                                                                                                                                                                                                        • Provides no type safety. (I imagine this one will be the least convincing to Go programmers, since Go generally expects the programmer to just not make mistakes)
                                                                                                                                                                                                        1. 3

                                                                                                                                                                                                          This brings me back to C++Builder 3 back in the 90s. To use a list, you had to create a class derived from a kind of TItem class to be able to store things. Why anyone would want to go back to that in productive code boggles my mind.

                                                                                                                                                                                                          1. 1

                                                                                                                                                                                                            I’m using a sync.Map (for its concurrency support - I have many goroutines writing map entries, and another goroutine periodically ranging over the entire map to dump it to a json file).

                                                                                                                                                                                                            However I know the types I write to the map, I have no need for interface{}.

                                                                                                                                                                                                            Am I better off with a real typed map + using sync.RWLock/mutex/etc. directly (in a custom struct)? Performance-wise.

                                                                                                                                                                                                            1. 1

                                                                                                                                                                                                              I don’t know, you would have to benchmark or measure CPU or memory usage. The sync.Map documentation suggests that using a regular map + mutexes could be better though: https://golang.org/pkg/sync/#Map

                                                                                                                                                                                                              The Map type is specialized. Most code should use a plain Go map instead, with separate locking or coordination, for better type safety and to make it easier to maintain other invariants along with the map content.

                                                                                                                                                                                                              The Map type is optimized for two common use cases: (1) when the entry for a given key is only ever written once but read many times, as in caches that only grow, or (2) when multiple goroutines read, write, and overwrite entries for disjoint sets of keys. In these two cases, use of a Map may significantly reduce lock contention compared to a Go map paired with a separate Mutex or RWMutex.

                                                                                                                                                                                                              If your usage falls outside of the two use cases which sync.Map is optimized for, it would absolutely be worth looking into replacing your sync.Map with a regular map and a mutex.

                                                                                                                                                                                                              I suppose it becomes a question of which has the biggest performance penalty for you, heap allocation + indirection with sync.Map or lock contention with regular map + mutex?

                                                                                                                                                                                                              (Also, in most cases, this probably doesn’t matter; make sure you’re not spending a long time improving performance in a part of your code which isn’t actually a performance issue :p)

                                                                                                                                                                                                              1. 1

                                                                                                                                                                                                                Right - the code “just works(TM)” and it takes around 0.5 seconds to render the JSON file every minute (which I track with metrics just to be safe) so it should be fine to keep as is. This is just a for-fun conversation.

                                                                                                                                                                                                                or (2) when multiple goroutines read, write, and overwrite entries for disjoint sets of keys. In these two cases, use of a Map may significantly reduce lock contention compared to a Go map paired with a separate Mutex or RWMutex.

                                                                                                                                                                                                                I definitely remember reading this sentence and it made me choose sync.Map because it sounds like my usecase. But like you say if I don’t measure it’ll be hard to tell.

                                                                                                                                                                                                        2. -1

                                                                                                                                                                                                          I don’t know and I didn’t think you could. I’m asking for an example use of an RB tree where using a library would make sense.

                                                                                                                                                                                                          1. 6

                                                                                                                                                                                                            Here is a popular Go RB tree implementation https://github.com/emirpasic/gods/ that uses Interface{} for the key and value types. Just search github for uses of it… With generics, users of this library would get greater typesafety.

                                                                                                                                                                                                            https://github.com/search?q=%22github.com%2Femirpasic%2Fgods%2Ftrees%2Fredblacktree%22&type=Code

                                                                                                                                                                                                            1. -2

                                                                                                                                                                                                              okay. except i don’t know how to search github for uses of it and your search link brings me to a login page :(

                                                                                                                                                                                                              1. 4

                                                                                                                                                                                                                To short-circuit this:

                                                                                                                                                                                                                At a previous job, I worked on a tool that started various services. The services had different dependencies, each of which needed to be started before the service. We wanted to be able to bring them up with as much parallelism as possible, or have a flag to launch them serially.

                                                                                                                                                                                                                A simple approach to doing this correctly is modeling the dependencies as an acyclic graph (if it’s a cyclic graph, you’ve got a problem — you can never bring the services up, because they all depend on each other). To launch them in parallel, launch each one that has its dependencies met. To launch them serially, topologically sort the graph into an array/list/whatever and launch them one by one.

                                                                                                                                                                                                                A generic graph implementation would be very useful, as would a topological sort that worked on generic graphs. With Go, you can’t have one that’s type-safe.

                                                                                                                                                                                                                Another great use case for graphs: visualizing dependency graphs! You can have an open source graph visualization library, build a graph of whatever it is you’re trying to visualize, and pass it to the library and get a nice visualization of the data.

                                                                                                                                                                                                                Graph data structures can be quite useful. Supporting generics makes them type-safe, so you catch errors at compile time instead of runtime. Some other examples of the usefulness of graphs:

                                                                                                                                                                                                                • Graphs of friends at a social network (I currently work at one, and we use generic graph data structures all over the place — graphs of people to people, graphs connecting people and photos they’re tagged in, etc)
                                                                                                                                                                                                                • Network topology graphs
                                                                                                                                                                                                                • Graphs of links between documents

                                                                                                                                                                                                                etc.

                                                                                                                                                                                                                And it’s not just graphs. How do you write a type-safe function that takes in a list of possibly-null items, and returns a new list with the nulls stripped out? How about a function that takes a map and returns the list of its keys? In Golang, the answer is always copy-paste or give up type safety. In languages with generics, you can trivially write these functions yourself if they’re not in the standard library.

                                                                                                                                                                                                                1. 1

                                                                                                                                                                                                                  thanks, this is a good motivating example.

                                                                                                                                                                                                                  1. 1

                                                                                                                                                                                                                    Huh. It had not occurred to me that github search would require a login.

                                                                                                                                                                                                        3. 11

                                                                                                                                                                                                          To turn the question around, why would you want to manually copy/paste code all over the place when the compiler can do it for you? And while I personally think “DRY” can be over done, not having the same (or very similar) code copy/pasted all over the place seems like a big practical win.

                                                                                                                                                                                                          As far as customizing specific data structure and type combinations, most languages with generics have a way to do that, and I’d bet the Go designers thought of it.

                                                                                                                                                                                                          1. 2

                                                                                                                                                                                                            Copy / paste has got it’s own problems, but it lets you avoid a ton of complexity in the toolchain.

                                                                                                                                                                                                            Toolchain development is all about tradeoffs. For instance, I use Typescript; the reference implementation is featureful, but slow to boot, so it keeps a background process alive to cache the heavy lifting, which accumulates state and introduces subtle confusions (eg type errors that don’t exist) until it’s restarted.

                                                                                                                                                                                                            For some problem spaces, the problems introduced by copy/paste pale in comparison to the problems introduced by slow, stateful compilers.

                                                                                                                                                                                                            1. 7

                                                                                                                                                                                                              Copy/paste vs generics is unrelated to compiler bugginess.

                                                                                                                                                                                                              If you carefully pick TypeScript as the comparison point, you can make the case that a buggy toolchain is bad (not that most users care, they just restart the compile process when it starts to go bad).

                                                                                                                                                                                                              But if you were to pick say ReasonML for comparison, you could say that it’s possible to have a solid generics implementation (much less copy-pasting) and a super-fast, accurate compiler.

                                                                                                                                                                                                              I.e. you can have both buggy and non-buggy compilers supporting generics. Hence, unrelated.

                                                                                                                                                                                                              1. 2

                                                                                                                                                                                                                ReasonML is great!

                                                                                                                                                                                                                That said, while the relationship is indirect, it’s there. Adding complexity is never free. It didn’t cost ReasonML speed or reliability, but it costs maintainers time and makes every other feature more difficult to add in an orthogonal way.

                                                                                                                                                                                                                1. 2

                                                                                                                                                                                                                  In the scheme of things, is it more important to have a super-simple compiler codebase, or is it more important to put more power and expressiveness in the hands of users? Note that every mainstream language that started without generics, has now added it.

                                                                                                                                                                                                                  1. 1

                                                                                                                                                                                                                    IMO, there’s such a thing as a right time to do it.

                                                                                                                                                                                                                    In the early years it’s more important to keep the simplicity - there aren’t that many users and you’re still figuring out what you want the language to be (not every feature is compatible with every approach to generics).

                                                                                                                                                                                                                    Once you’re ready to start generics you need to answer questions like - do you want monomorphisation or lookup tables? Is boxing an acceptable overhead for the improved debugging ergonomics?

                                                                                                                                                                                                                    1. 1

                                                                                                                                                                                                                      It seems like Go has been going through exactly the process you’re describing.

                                                                                                                                                                                                                  2. 2

                                                                                                                                                                                                                    I think these comparisons are a bit unfair: isn’t Typescript self hosted, whereas ReasonML is written in OCaml? It seems like Typescript would have a very hard time competing.

                                                                                                                                                                                                                    1. 3

                                                                                                                                                                                                                      Being able to use lots of existing OCaml bits is a huge advantage.

                                                                                                                                                                                                                      Typescript has been able to compete due to the sheer number of contributors - MS pays quite a large team to work on it (and related stuff like the excellent Language Server Protocol, VScode integration).

                                                                                                                                                                                                                      However, large teams tend to produce more complex software (IMO due to the added communications overhead - it becomes easier to add a new thing than find out what existing thing solves the same problem).

                                                                                                                                                                                                                      1. 1

                                                                                                                                                                                                                        I should clarify my comment was more about comparing performance of the two languages.

                                                                                                                                                                                                                        OCaml is a well optimized language that targets native machine code so tooling built in OCaml should be more performant than tooling built in Typescript. As a result, it’s hard to compare the complexity of either tool by the performance of the tool. It’s apples and oranges.

                                                                                                                                                                                                                      2. 2

                                                                                                                                                                                                                        isn’t Typescript self hosted, whereas ReasonML is written in OCaml? It seems like Typescript would have a very hard time competing.

                                                                                                                                                                                                                        That’s a strange argument. If it were very hard for them to compete why would they not use OCaml as well, especially since its contemporary alternative, Flow, was written in OCaml too? Or why would they not make TypeScript as good as a language for writing TypeScript in as OCaml is?

                                                                                                                                                                                                                        1. 1

                                                                                                                                                                                                                          My comment was more about performance, but it wasn’t very clear. It’s hard for Typescript, which is compiled to Javascript and then interpreted/JITed, to create tooling that’s as fast as a language that builds optimized native code.

                                                                                                                                                                                                                          Given that Typescript is self hosted it has the advantage that community involvement is more seamless and I don’t want to downplay the power that brings.

                                                                                                                                                                                                                    2. 0

                                                                                                                                                                                                                      But compilers that support generics are more likely to be buggy. That’s a relation.

                                                                                                                                                                                                                      1. 2

                                                                                                                                                                                                                        Any source for this rather surprising assertion?

                                                                                                                                                                                                                        1. 0

                                                                                                                                                                                                                          generics are feature that requires code to implement; code can contain bugs.

                                                                                                                                                                                                                          1. 1

                                                                                                                                                                                                                            But a self-hosting compiler with generics is likely to be less verbose (because generics) than one without, so it should be less buggy.

                                                                                                                                                                                                                            1. 1

                                                                                                                                                                                                                              i guess you can’t prove it either way but IME the complexity of algorithms is more likely to cause bugs than verbosity.

                                                                                                                                                                                                                    3. 5

                                                                                                                                                                                                                      I think Typescript is a straw man. Does this Go implementation of generics slow down the compiler a noticeable amount? There’s nothing inherent to generics that would make compiling them slow.

                                                                                                                                                                                                                      On the other hand, copy/pasted code is an ever increasing burden on developer and compile time.

                                                                                                                                                                                                                    4. -2

                                                                                                                                                                                                                      You are imagining a code base where the same complex data structure is instantiated with two different types. Is that realistic?

                                                                                                                                                                                                                      1. 5

                                                                                                                                                                                                                        You are imagining a code base where the same complex data structure is instantiated with two different types. Is that realistic?

                                                                                                                                                                                                                        Realistic enough that the Linux kernel developers went through the hassle of developing generic associative arrays, circular buffers, and other generic data structures using void*.

                                                                                                                                                                                                                        And so did Gnome with GLib, which provides generic lists, hash tables, and trees, along with several others structures, also using void*.

                                                                                                                                                                                                                        And the standard libraries of most modern languages include reusable and generic sequence and associative data types, and some times significantly more than that.

                                                                                                                                                                                                                        For most data structures, though, focusing on a single code base gives too narrow of a view. Generics allow libraries of data structures to be created, so even though a single code base only use one R* tree (or whatever), that R* tree library can be used as-is by any number of projects.

                                                                                                                                                                                                                    5. 8

                                                                                                                                                                                                                      The Abstract and Background sections of the draft design doc touch on the motivations. Additionally, each section describing a dimension of the design usually mentions, at least briefly, the motivation for that feature.

                                                                                                                                                                                                                      1. 8

                                                                                                                                                                                                                        Here is an example that I’ve wanted for ever, and can finally do. Higher order combinators that you can leverage first class functions with!

                                                                                                                                                                                                                        Generic map, in go

                                                                                                                                                                                                                        1. 1

                                                                                                                                                                                                                          That’s the type of thing I have seen as a justification, but I don’t get why that’s so important. Can’t you just use a for loop?

                                                                                                                                                                                                                          1. 22

                                                                                                                                                                                                                            “Can’t you just …” goes forever. “Can’t you just write your for loop with labels and jumps in assembly?”^^

                                                                                                                                                                                                                            For me, it’s all about abstraction. Having low level combinators, like this, that I can compose to build higher level abstractions in a generic way is wonderful.

                                                                                                                                                                                                                            ^^: See also whataboutism.

                                                                                                                                                                                                                            1. 3

                                                                                                                                                                                                                              I’m not sure that composing from higher level abstractions is always such a good idea. I like both Go (hobby projects) and Rust (work!) but I still fell that most of the time I prefer this level of abstraction:

                                                                                                                                                                                                                              type Server struct {
                                                                                                                                                                                                                              ...
                                                                                                                                                                                                                                  Handler Handler // handler to invoke, http.DefaultServeMux if nil
                                                                                                                                                                                                                              ...
                                                                                                                                                                                                                              }
                                                                                                                                                                                                                              type Handler interface {
                                                                                                                                                                                                                                  ServeHTTP(ResponseWriter, *Request)
                                                                                                                                                                                                                              }
                                                                                                                                                                                                                              

                                                                                                                                                                                                                              from this:

                                                                                                                                                                                                                               pub fn serve<S, B>(self, new_service: S) -> Server<I, S, E>
                                                                                                                                                                                                                                  where
                                                                                                                                                                                                                                      I: Accept,
                                                                                                                                                                                                                                      I::Error: Into<Box<dyn StdError + Send + Sync>>,
                                                                                                                                                                                                                                      I::Conn: AsyncRead + AsyncWrite + Unpin + Send + 'static,
                                                                                                                                                                                                                                      S: MakeServiceRef<I::Conn, Body, ResBody = B>,
                                                                                                                                                                                                                                      S::Error: Into<Box<dyn StdError + Send + Sync>>,
                                                                                                                                                                                                                                      B: HttpBody + 'static,
                                                                                                                                                                                                                                      B::Error: Into<Box<dyn StdError + Send + Sync>>,
                                                                                                                                                                                                                                      E: NewSvcExec<I::Conn, S::Future, S::Service, E, NoopWatcher>,
                                                                                                                                                                                                                                      E: H2Exec<<S::Service as HttpService<Body>>::Future, B>,
                                                                                                                                                                                                                                  {
                                                                                                                                                                                                                                  ...
                                                                                                                                                                                                                              

                                                                                                                                                                                                                              Don’t get me wrong, i like type level guarantees and I can see flexibility here, but in my experience with c++, rust and haskell is that generic programming often ends up complicating things to a degree that I personally don’t like.

                                                                                                                                                                                                                              1. 1

                                                                                                                                                                                                                                I think this is going to be a balance that the community has to find. I don’t regularly program in rust, but I’d be quite surprised if it wasn’t possible to get something close to the Go http API in it. The example you pasted seems complicated for the sake of being complicated. In theory, the Go community has been drilled into thinking in terms of the littlest abstraction that’ll work, which maybe makes it possible to generally avoid generic APIs that don’t actually need to be?

                                                                                                                                                                                                                              2. 3

                                                                                                                                                                                                                                “Can’t you just” does not go forever. It is a simpler way to say that the alternative is not significantly harder than what’s proposed. Is there some type of task that would be doable using a generic map but unreasonably hard using for loops?

                                                                                                                                                                                                                                I feel like Go was designed from the ground up to be written in an imperative style, and composing first order functions is more of a functional style of coding. If I understand, without generics you would be nesting for loops rather than composing map functions, which is no more difficult to understand or write.

                                                                                                                                                                                                                                I don’t follow the connection to whataboutism.

                                                                                                                                                                                                                                1. 2

                                                                                                                                                                                                                                  I think it’s fine for your style of writing code to be to use loops and conditionals instead of map and filter. I think it’s a fine way to code that makes more sense in an imperative language. Straight for loops and while loops with if statements inside them is just better, more easily understandable code in an imperative language, in my opinion, than .map(...).filter(...).map(...) etc.

                                                                                                                                                                                                                                  1. -1

                                                                                                                                                                                                                                    Incidentally there is a repo wherein Rob Pike expresses his attitude towards this style of coding:

                                                                                                                                                                                                                                    https://github.com/robpike/filter/

                                                                                                                                                                                                                                    I wanted to see how hard it was to implement this sort of thing in Go, with as nice an API as I could manage. It wasn’t hard.

                                                                                                                                                                                                                                    Having written it a couple of years ago, I haven’t had occasion to use it once. Instead, I just use “for” loops.

                                                                                                                                                                                                                                    You shouldn’t use it either.

                                                                                                                                                                                                                                    1. 2

                                                                                                                                                                                                                                      I mean… that’s like … one man’s opinion… man. See also.

                                                                                                                                                                                                                                      Generics are going to create a divide in the Go community, and it’s going to be popcorn worthy. There’s no point of adding Generics to the language if this filter thing “shouldn’t be used,” and the community rejects the abstractions that Generics provide.

                                                                                                                                                                                                                                      This divide is easily already seen in the community as it relates to test helpers. On the one hand, there’s a set of developers that say “stdlib testing is more than enough.” On the other hand, there are people who want the full testing facilities of junit, with matchers, lots of assert style helpers, etc. Who is right? They all are, because those things work for their respective teams and projects.

                                                                                                                                                                                                                                      This general dogmatic approach to language idioms is why I call it “idiotmatic” Go.

                                                                                                                                                                                                                                      1. -1

                                                                                                                                                                                                                                        I suppose if Ken and Rob wanted generics they would’ve put them in the original language, and there wouldn’t be this controversy. Time to go back to learning Erlang which seems old and dusty enough to not have big language changes and drama.

                                                                                                                                                                                                                                  2. 16

                                                                                                                                                                                                                                    You can’t pass a for loop to anything, you can only write it where you need it. Sure, toy examples look like toy examples, but the fact remains that Go has first-class functions, which should be a nice thing, but it doesn’t actually have a type system rich enough to express 90% of the things that make first-class functions worth having.

                                                                                                                                                                                                                                    1. -1

                                                                                                                                                                                                                                      You can’t pass a for loop to anything, you can only write it where you need it.

                                                                                                                                                                                                                                      right, so the example code could be done with a for loop no problem. is there a more motivating example?

                                                                                                                                                                                                                                      it doesn’t actually have a type system rich enough to express 90% of the things that make first-class functions worth having.

                                                                                                                                                                                                                                      how do you mean?

                                                                                                                                                                                                                                    2. 3

                                                                                                                                                                                                                                      Consider composing multiple transformations and filters together. With multiple for loops you have to iterate over the array each time, while by composing maps you only need to iterate once.

                                                                                                                                                                                                                                      1. 3

                                                                                                                                                                                                                                        Just compose the operations inside the loop.

                                                                                                                                                                                                                                        for x in y:
                                                                                                                                                                                                                                            ...f(g(x))...
                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                        1. 2

                                                                                                                                                                                                                                          That works in some cases, but it’s pretty easy to find a counter example, too.

                                                                                                                                                                                                                                  3. 7

                                                                                                                                                                                                                                    In terms of collections, the truth is most of the time a map/slice is a good option. Here’s my top two favorite use cases for generics in go:

                                                                                                                                                                                                                                    1. Result<T> and functions that compose over them.
                                                                                                                                                                                                                                    2. Typesafe versions of sync.Map, sync.Pool, atomic.Value, even a rust like Mutex
                                                                                                                                                                                                                                    1. 5

                                                                                                                                                                                                                                      Oh man. I hadn’t even considered a better way to do error handling, eg. a Result type. People are gonna get so mad.

                                                                                                                                                                                                                                      1. 5

                                                                                                                                                                                                                                        Generics isn’t enough to do what people want to do with error handling 99.99% of the time, which is to return early. For that, you either need a macro, such as the aborted try proposal, or syntactic sugar for chaining such “functions that compose over them” (like Haskell’s do notation).

                                                                                                                                                                                                                                        Otherwise you end up with callback hell à la JavaScript, and I think nobody wants that in Go.

                                                                                                                                                                                                                                        1. 4

                                                                                                                                                                                                                                          I was more thinking of something where the if err pattern is enforced via the type system. You’re still not getting there 100%, you could get reasonably close, with a generic Result type that panics when the wrong thing is accessed, forcing you to check always or risk a panic.

                                                                                                                                                                                                                                          r := thing()
                                                                                                                                                                                                                                          if r.HasError() { handleError(r.Err()) }
                                                                                                                                                                                                                                          else v := r.Val() { handleSuccess(v) }
                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                          And of course it’s easy to question why this is interesting until you do chaining of things, and get a full on, type safe Result monad.

                                                                                                                                                                                                                                          r := thing().andThen(func(i int) { ... }).andThen(func(i int) { ... })
                                                                                                                                                                                                                                          if r.IsErr() {
                                                                                                                                                                                                                                             handleErrForWholeComputation(r.Err())
                                                                                                                                                                                                                                          } else {
                                                                                                                                                                                                                                             handleSuccessForWholeComputation(r.Val())
                                                                                                                                                                                                                                          }
                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                          The alternative can be seen in things like this where you skirt around the fact that you can’t generically accept a value in one of those called functions. This is also why I said people are going to get so mad. These things are confusing to people who haven’t dealt with them before, and will make Go much more expressive, but less easy to grok without effort.

                                                                                                                                                                                                                                    2. 5

                                                                                                                                                                                                                                      but is there a real-world setting where this is actually better than just copying code and doing s/type1/type2/g

                                                                                                                                                                                                                                      All of them. Copying code manually is one of the worst things you can do in software development. If it weren’t, why even bother writing functions, ever?

                                                                                                                                                                                                                                      My sense is that projects that use complex data structures almost always customize the data structures in a way that depends on the data type being stored.

                                                                                                                                                                                                                                      The fact that libraries exist that don’t customise in such a way in languages with generics would disprove that notion.

                                                                                                                                                                                                                                      1. 6

                                                                                                                                                                                                                                        one of the worst things you can do in software development

                                                                                                                                                                                                                                        For me that’s “making things unreadable for whoever comes after you”. And sometimes copying a bit of code is the optimal solution for avoid that.

                                                                                                                                                                                                                                        1. 0

                                                                                                                                                                                                                                          but is there a real-world setting where this is actually better than just copying code and doing s/type1/type2/g

                                                                                                                                                                                                                                          All of them. Copying code manually is one of the worst things you can do in software development. If it weren’t, why even bother writing functions, ever?

                                                                                                                                                                                                                                          I disagree with your implication that the use of functions means code should never be copied. For example if you want to use strlcpy() in a portable C program, it makes more sense to put a copy in your source tree rather than relying on an external library. An extra dependency would add more headache than just copying the code.

                                                                                                                                                                                                                                          My sense is that projects that use complex data structures almost always customize the data structures in a way that depends on the data type being stored.

                                                                                                                                                                                                                                          The fact that libraries exist that don’t customise in such a way in languages with generics would disprove that notion.

                                                                                                                                                                                                                                          That’s why I said “almost always.” And remember that the existence of a library doesn’t mean it is used with any frequency.

                                                                                                                                                                                                                                        2. 3

                                                                                                                                                                                                                                          Suppose you have a structure parametrizable by types T1, T2. You’re writing it in Go, so you assume that it’s ok if T1=string, T2=int. Also, in some of the places, you were using int for purpose unrelated to T2 (ie. if T2=foo, then there are still ints left in the source). Another programmer wants to copy-paste the code and change some types. How does he do it?

                                                                                                                                                                                                                                          1. 2

                                                                                                                                                                                                                                            I think “this would make copy-pasting code harder” is not so compelling an argument. One of the major points of introducing generics is that it would eliminate much of the present need for copy/paste in Go.

                                                                                                                                                                                                                                            1. 2

                                                                                                                                                                                                                                              Yes it would be harder than a search-and-replace, but that is still abstract and unrelated to any real-world use case.

                                                                                                                                                                                                                                              Yes, I’m just counterpointing the parent commenter’s argument. I know the value of generic structures.

                                                                                                                                                                                                                                            2. -1

                                                                                                                                                                                                                                              Yes it would be harder than a search-and-replace, but that is still abstract and unrelated to any real-world use case.