noli

@noli@programming.dev
1 Post – 70 Comments
Joined 13 months ago

Dogmatic statements like this lead to bad, messy code. I'm a firm believer that you should use whatever style fits the problem most.

Although I agree most code would be better if people followed this dogma, sometimes mutability is just more clean/idiomatic/efficient/...

1 more...

But rust

1 more...

In functional programming, everything is seen as a mathematical function, which means for a given input there is a given output and there can be no side effects. Changing a variable's value is considered a side effect and is thus not possible in pure functional programming. To work around this, you typically see a lot of recursive and higher order functions.

Declaring all values as const values is something you would do if you're a diehard functional programmer, as you won't mutate any values anyway.

5 more...

Nvm fixed it

2 more...

You clearly don't use this one, don't you know lemmy instances automatically censor your ********?

3 more...

Which is why I'm of the opinion that dynamically typed languages are evil. !!"false" should either be caught at compile time or raise an exception.

I'm thoroughly convinced that the only use of dynamically typed languages is to introduce bugs

8 more...

Compiler optimizations like function inlining are your friend.

Especially in functional languages, there are a lot of tricks a compiler can use to output more efficient code due to not needing to worry about possible side effects.

Also, in a lot of cases the performance difference does not matter.

I see, so I'm assuming the same goes for regular actors? And musicians? And basically any performer ofcourse? Oh and also anyone who does manual labour because you are literally renting out your body for that. Well, and technically anyone with an office job too because they are still renting out their time.

The typical arguments for a dynamic typed language are that it takes less time to write something in it.

The benefits of static typed languages are that your development environment can be a lot smarter (ironically enough leading to faster development speed) and several classes of bugs being unable to happen. In a statically typed language, the IDE can detect if you're trying to call a function that takes a number but you're actually providing a string. In this case the IDE will let you know and you can immediately fix silly mistakes like that.

To answer that question it might be useful to ask a different question: "If people depend on money to survive and if that money is made through manual labour. Does this imply that manual labour is slavery through coercion?"

6 more...

Flipping burgers is enough to pay for chemotherapy. Src: am european

Oops, so silly of me!

On a totally unrelated note, this is also a funny meme. Hope it helps with your disappointment of this post!

Depends on how deep down the rabbit hole you want to go :p

  • creating a new variable that contains the updated value
  • recursion (e.g. it's not possible to make a loop that increments i by 1, but it is possible to turn that loop into a function which calls itself with i+1 as argument)
  • avoiding typical types of operations that would update variable values. For example instead of a for loop that updates every element of a list, a functional programmer will use the map function, which takes a list and a function to apply to each element of that list to create an updated list. There's several more of these very typical functions that are very powerful once you get used to using them.
  • monads (I'm not even gonna try to explain them as I hardly grasp them myself)
1 more...

One crate is still one item

if(condition) statement; Is valid in typical C-style syntax.

if condition { ... }

Is invalid in typical C-style syntax

That's actually hilarious

Typescript saves ridiculous amounts of time in bugfixes and is IMO a lot more readable than JS.

I don't know how many times TS has complained about some type mismatch in my code that made me scratch my head for 2 seconds to only then realize I was doing something stupid. With plain JS that would've been no issue, until I have some obscure bug 30 minutes later and have to figure out it's source.

Also, whatever piece of code you are working on, to do anything you have to have the types of your variables/functions in mind. If you have to keep track of all of them in your head, you will definitely mess it up at some point or have to look through a bunch of different methods/files to track down the source of some piece of data to be certain what's contained in it.

So yeah, TS might take slightly longer to type out, but it saves you a lot of dev time.

5 more...

Here: "yes it does support TLS1.3"

FreeRTOS tasks are basically processes, IIRC other rtoses have similar mechanics too

2 more...

Also surely a lot of people would know tar -Create Ze Vucking File and/or tar -Xtract Ze Vucking File

Actually I'm not so sure. That honestly sounds like it could lead to several significant issues, such a

JS was a mistake.

"Your secret is safe with my indifference" - Taliesin Jaffe

Alternatively, get good, consistently win games against people who are worse, stop coping and you'll get to the rank you deserve.

There is no such thing as elo hell, if you're consistently outperforming your direct opponent you will win more games than you lose against people of your MMR and you will climb. "Elo hell" is just a coping mechanism for people who can't admit they're bad

Depends on your eslint config, but yeah that's an option.

Nope, IaaS. With a VPS you are in charge of everything except for the hardware. PaaS the only thing you're in charge of is your code.

You can describe anything that's consumed by people with chemical terms and it's gonna sound unnatural.

You remind me of that old joke site warning people of the dangers of the chemical compound DHMO (dihydrogen monoxide)

Dot in dutch is punt

1 more...

I know they are used in google's BigTable. All data there is stored in seperate SSTables and you can specify that a locality group should have bloom filters generated for its SSTables. Apparently cassandra has them too.

Both are the same general application though and you already mentioned databases.

I did think about using them at some point for authentication purposes in a webservice. The idea being to check for double uses of a refresh token. This way the user database would need to store only a small amount of extra storage to check for the reuse of a refresh token and if you set the parameters accordingly, the false positives are kind of a benefit in that users cannot infinitely refresh and they actually have to reauthenticate sometimes.

Edit to add: I also read a paper recently that uses a datastructure called a collage that is closely related to bloom filters to perform in-network calculations in a sensor network. If I understand correctly, the basic idea there is that every node in the network adds a bit to the datastructure while it is in transit, so data from the entire network is aggregated. The result can then be fed to a classifier ML model. (Source: Oostvogels, J., Michiels, S., & Hughes, D. (2022). One-Take: Gathering Distributed Sensor Data Through Dominant Symbols for Fast Classification. )

2 more...

Why? Cause shops are open on sunday? Having no workers rights makes that a lot easier

6 more...

I am dumb. The more things I need to think about when reading code that is not the logic of the code, the worse it is. Any time I have to spend thinking about the peculiarities of the way the language handles something is time wasted.

I'll give a very simple example, think like you're trying to find a bug. Assume we're in a dynamic language that allows implicit conversion like this. We can write our code very "cleanly" as follows:

if(!someVar) doSomething();

-> ok, now we gotta check where someVar's value is last set to know what type of data this is. Then I need to remember or look up how those specific types are coerced into a bool.

When trying the same code in a statically typed language that doesn't do implicit coercion that code will fail to run/compile so probably you'll have something like this:

if(someVar.length() == 0) doSomething();

-> this time I can just look at the type of someVar to see it's a string and it's clear what the condition actually means.

The second option is both easier to read and less bug prone even without the type system. It takes maybe 3 seconds longer to type, but if your productivity in coding is that limited by typing speed then I envy you

Isn't that still the same exact process as a normal compiler except in the case of embedded systems your OS is like a couple kilobytes large and just compiled along with the rest of your code?

As in, are those "crazy optimizations" not just standard compiler techniques, except applied to the entire OS+applications?

4 more...

How did a bug with something like that never pop up in unit tests?

1 more...

Fun fact: lots of those sd cards are actually fake. Have you tried actually putting 128gb of data on it?

It's pretty easy for them to put a scummy firmware on it that reports having a significantly larger size than they actually have.

Technically this is also possible with for loops, like with OpenMP

1 more...

Always practice safe stacks

If you get prep time you could set up some traps.

Assuming both sides see it as a fight to the death, the horse will also engage so you could just run away into a bunch of traps. All you need is for the horse to injure a leg in one trap and it's done for. I think even just some holes with a couple spikes would be enough to injure and maybe even sprain an ankle.

Without prep time you're pretty doomed, I think your best bet is either climbing up a tree to buy you some prep time to make a spear out of the branches or worst case diving in, aiming to do damage to its legs (unlikely) and hope you are able to get out without being trampled (unlikely)

2 more...

Reminds me of the old joke that monads are easy to understand, you just have to realize monads are just monoids in the class of endofunctors.

Is that just like the shared memory model of parallel computing or are there any added complications? Have you done this before? Please do share your experiences if so cause now I'm interested :p

That's actually a really nice application, in this case to reduce bandwidth constraints as opposed to the usual use case of memory constraints!