• 0 Posts
  • 22 Comments
Joined 1 year ago
cake
Cake day: July 1st, 2023

help-circle






  • But why bother with creating a new language, and duplicating all the features your language already has, in a weird way?

    If I want a list of UI items based on an array of some data, I can just do items.map(item => 〈Item key={item.id} item={item} /〉), using the normal map function that’s already part of the language.

    Or I can use a function, e.g. items.map(item => renderItem(item, otherData)) etc.

    JSX itself is a very thin layer that translates to normal function calls.




  • realharo@lemm.eetoProgramming@programming.dev*Permanently Deleted*
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    edit-2
    1 year ago

    On one hand, this is definitely a gap, on the other hand, you are very unlikely to run into it in practice.

    The whole “pass an array/object into some function that will mutate it for you” pattern is not very popular in JS , you are much more likely to encounter code that just gives you a new array as a return value and treats its arguments as read-only.

    If you validate your data at the boundaries where it enters your system (e.g. incoming JSON from HTTP responses), TypeScript is plenty good enough for almost all practical uses.


  • Clickbait title.

    The packages were collectively downloaded 963 times before they were removed. The rogue packages include names like “noblox.js-vps,” “noblox.js-ssh,” and “noblox.js-secure,” and they were distributed across specific version ranges

    Is there any indication that anyone actually installed these, other than some bots that auto download all packages and such?

    You would have to really go out of your way to get infected by stuff like this.

    That being said, there are things npm could do to try to auto-detect “risky” packages (new, similar name to existing projects, few downloads, etc.) and require an additional layer of confirmation, or something like that.


  • This is exactly the point made in this 2010 article that’s probably one of the things I link to most often in online discussions.

    https://whatheco.de/2010/12/07/function-hell/

    Also, the real problem with code on the right in OP is all the state mutations made to the arguments passed into the functions.

    Not too familiar with golang, but this really could use some sort of builder pattern or something, if you’re going to mutate the object. Or a more functional style with just a pure function mapping an input “order” to output “toppings”, etc.

    There are plenty of ways to make the bad design on the right better without stuffing everything into a single function, so the whole premise is a bit of a false dichotomy.








  • The main pitch is that you don’t have to spend time and effort with installing and configuring a project for development when onboarding new people to it, or when you want to contribute to someone else’s project etc.

    You get a proven, up-to-date “works on my machine” kind of environment that others also use, and you don’t need to “pollute” your host system by installing additional tools necessary for each individual project. Compilation (and other build steps), running the project, running the tests, debugging, IDE configuration (e.g. language servers, linter plugins), etc. all happen inside the container.

    I personally don’t find it all that useful for projects I’m working on long-term myself, but it’s nice if you need to check something in someone else’s project which you’re not that familiar with.