• 0 Posts
  • 21 Comments
Joined 1 year ago
cake
Cake day: June 13th, 2023

help-circle

  • Apparently the maintainer trusted the first-time contributor enough to propose tackling another bug.

    There is no trust needed when asking someone to fix a bug. It’s not like the maintainer would lose anything if the contributor failed to fix the bug.

    Besides, I think it is natural to want recognition when you do a lot of work for free. Many other people wouldn’t do this unpaid work at all; recognizing their contribution is the bare minimum of good manners. Even in a company where employees are paid for their work, it is customary to give credit to co-workers who have helped you. Most people don’t like to work in places where they don’t feel appreciated, and that is also true in Open-Source.


  • It’s not possible to instantiate or assign, which is more like a never type than a unit

    Actually, this is because void is not a type, it is just a keyword, a placeholder used instead of the return type when a function doesn’t return anything.

    If it were a bottom type, that would mean that a method returning void must diverge, which is simply not true.

    Also, if it were a bottom type, it would be possible to write an “unreachable” method

    void unreachable(void bottom) {
        return bottom;
    }
    

    Even though it couldn’t be called, it should be possible to define it, if void was a bottom type. But it is not, because void isn’t a bottom type, it’s no type at all.



    • Svelte/Vue/React components need to be compiled
    • JavaScript should be minified if the project has a significant size
    • File names should have a content hash, so they can be cashed in the browser
    • Even with HTTP/2, there’s still a case to be made for bundling hundreds or thousands of JS modules into a single file for better performance
    • Bundlers give you a dev server with live reload and hot module replacement for great developer experience
    • Setting up Vite is really easy and requires minimal configuration (compared to Webpack, for example)

  • Easy interop with legacy code is how kotlin took off, so maybe it will work out?

    Good interop was a requirement for widespread adoption, but not the reason why programmers want to use it. There’s also null safety, a much nicer syntax, custom DSLs, sealed classes, type inference, data classes, named and optional arguments, template strings, multi-line strings, computed properties, arbitrary-arity function types, delegation, custom operators, operator overloading, structural equality, destructuring, extension methods, inline functions and non-local control flow, reified types, …

    Some of these features have since been added to Java.


  • Whenever possible, it’s recommended to work in a common Git repository and use branching strategies to manage your work. However, if you do not have write access for the repository you want to contribute to, you can create a fork.

    A fork is a personal copy of the repository and all its branches, which you create in a namespace of your choice. Make changes in your own fork and submit them through a merge request to the repository you don’t have access to.

    https://docs.gitlab.com/ee/user/project/repository/forking_workflow.html

    How is this different from GitHub?

    Just to make sure there’s no misunderstanding: When I want to contribute to a project I’m not involved in, like inkscape, I’m not allowed to create a branch in their repo, so I have to fork it, which creates a copy of the repo, and sets the original repo as a remote.

    Note that git is a distributed VCS that doesn’t distinguish between servers and clients. Forking and cloning are the same operation from a technical perspective, except when you git clone, the copy ends up on your local machine, and when you press the “fork” button, the copy is on a GitHub/GitLab server.


  • Over the years people have developed an unbelievable number of coding languages. They all do pretty much the same job in pretty much the same way.

    That’s one way to say that you don’t know a lot about programming languages.

    Personally I have coded in Mercury Autocode, COBOL, FORTRAN, PL/1, LISP, Assembler, PERL, basic, C, C++ and JavaScript plus probably some others I have forgotten.

    Sadly, there’s no functional language in this list except LISP.

    JavaScript’s longevity is assured for one reason. Browsers only support JavaScript.

    Incorrect, browsers also support WebAssembly, which allows many languages (including C, C++, Rust, zig, Go, and many more) to run in the browser. And even without WebAssembly, languages can be transpiled to JavaScript, so you don’t need to code in JavaScript to run your code in the browser. Languages that can be transpiled to JavaScript include TypeScript, CoffeeScript, Reason, Elm, PureScript, Dart, Kotlin, Scala, Nim, …

    However JavaScript has a flaw.

    Not just one. Every programming language is flawed. Some languages have no type safety, some have no memory safety, some have no thread safety (or no multithreading to begin with), some are too slow for certain applications, some have an incomprehensible or verbose syntax, most support only one (sometimes two) paradigms (functional / imperative / object-oriented / logical), some have no proper module system, or no control over mutability, or visibility, or memory allocation, or side effects… some lack ergonomic error handling, or cooperative multitasking facilities such as coroutines, or generators, or macros, or reflexion…

    If you don’t appreciate the vast design space that is programming languages, of course you won’t understand why there are so many of them.



  • Even if this was true in 2013, when this article was written, the more accurate answer today would be “it depends”.

    In Rust, there are multi-threaded async executors implementing M:N threading (e.g. tokio), where M asynchronous tasks are mapped to N operating system threads. So when you await, the rest of the function may very well run in a different OS thread.

    Swift also has async/await, and like tokio it uses multiple threads to run concurrent tasks in parallel (therefore using multiple OS threads).

    Scala’s equivalent to asynchronous tasks are Promises, which can also run in parallel, as I understand it.

    Kotlin doesn’t have async/await, but it has a similar concept, coroutines, which are basically a superset of asynchronous tasks. While Kotlin’s coroutines are single-threaded by default, there is a multi-threaded implementation, enabling truly parallel coroutines.

    Go also uses coroutines (which it calls “goroutines”), which can use multiple threads.

    C++ will soon get coroutines as well, which support multithreading to run coroutines in parallel.




  • Lemmy is like Reddit, which is used a lot to ask questions and get help. But StackOverflow fills a different niche, it’s meant to be useful to as many people as possible and stay up to date. This is why

    • there’s a distinction between “comments” and “answers” (comments can be used to request additional information, and for meta discussion)
    • both questions and answers can be modified by other users, for example to
      • add more information, or remove unnecessary details
      • correct outdated information
      • fix typos and formatting
      • rephrase sentences that are confusing
    • a question can be closed as duplicate, so people always find the oldest thread of the question with the best/most detailed answers
    • before submitting a question, you get a list of related questions to avoid creating a duplicate question
    • questions have tags, making them easier to search for

  • Iframes cannot access the main frame’s DOM if the iframe is from a different origin than the main frame, and they never share the same JavaScript execution context, so an iframe can’t access the main frame’s variables etc.

    It’s not required that iframes run in a different process, but I think they do at least in Chrome and Firefox if they’re from a different origin. Also, iframes with the sandbox attribute have a number of additional restrictions, which can be individually disabled when needed.



  • I do not use AI to solve programming problems.

    First, LLMs like ChatGPT often produce incorrect answers to particularly difficult questions, but still seem completely confident in their answer. I don’t trust software that would rather make something up than admit that it doesn’t know the answer. People can make mistakes, too, but StackOverflow usually pushes the correct answer to the top through community upvotes.

    Second, I rarely ask questions on StackOverflow. Most of the time, if I search for a few related keywords, Google will find an SO thread with the answer. This is much faster than writing a SO question and waiting for people to answer it; and it is also faster than explaining the question to ChatGPT.

    Third, I’m familiar enough with the languages I use that I don’t need help with simple questions anymore, like “how to iterate over a hashmap” or “how to randomly shuffle an array”. The situations where I could use help are often so complicated that an LLM would probably be useless. Especially for large code bases, where the relevant code is spread across many files or even multiple repositories (e.g. a backend and a frontend), debugging the problem myself is more efficient than asking for help, be it an online community or a language model.