There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

Lepsea , in traslation: i made that bug 15 years ago and have been waiting for it to matter.
Ziglin , in C++ oop in a nutshell

Does C++ actually have something like that? That sounds like something made up for the joke?

BeigeAgenda ,
@BeigeAgenda@lemmy.ca avatar

It’s part of the language: en.wikipedia.org/wiki/Friend_class

Ziglin ,

Huh, do Java and other oop languages have them too and what are some good reasons to use them?

UnfortunateShort ,

It allows for more fine grained access control and to implement afterthoughts.

Think having some private function that can break things if called improperly, but also allow you to avoid significant overhead when calling it the correct way. For example you could be avoiding input validation in a public wrapper for that function. If your friendly class already does it, or cannot produce invalid inputs, there is no need for that.

You could also implement logging after the fact, because your friendly logger object to read private members.

Arguably it’s a questionable design decision tho, as you could do all of this in other ways and it basically breaks any guarantees private would usually give you.

Ziglin ,

That was a problem I saw with it but I guess it’s useful too. I like structs.

Lemminary , in W3C pls give us :focus-visible-within

Now try that but inline! Tailwind gang, where you at

Strawberry OP ,

I have not used tailwind personally and I’m a fan of keeping the markup simple but to each their own

Lemminary ,

I suggest trying it out in a project first to get a good idea of why it’s so popular

LinearArray , in And for everyone wondering, the street in the middle is not one way.
@LinearArray@programming.dev avatar

GTA moment

wise_pancake , in W3C pls give us :focus-visible-within

I miss when CSS was tables. Now I don’t even recognize it with variables and compilers.

Strawberry OP ,

It’s so much more fun now though! Things like grid layout and flex box have really changed the game. Also idk if you were saying otherwise but this has no variables and is vanilla CSS

wise_pancake ,

I do like flex layout, it’s very cool!

I’ve been out of the css game for a while though, so now I’m totally lost

penquin , in Every damn time.
@penquin@lemmy.kde.social avatar

Me looking at my unit tests failing one after another.

IWantToFuckSpez , in Every damn time.

Yeah but have you ever coded shaders? That shit’s magic sometimes. Also a pain to debug, you have to look at colors or sometimes millions of numbers trough a frame analyzer to see what you did wrong. Can’t program messages to a log.

CanadaPlus ,

Can’t you run it on an emulator for debugging, Valgrind-style?

Murvel , in C++ oop in a nutshell

Ohhh gottem!

She is now legally obligated to sex this man.

edit: programmers code

Goun ,

Normies hate this trick!

spez ,

lmao ‘sex this man’. hahahhaha

Murvel ,

Yup, that’d be the joke

loxdogs , in Functional bros be like

can someone explain please?

noli ,

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.

loxdogs ,

thanks, kinda understand

Mir ,

What is the best practice then when you want to update a variable’s value?

Nomecks ,

j = i + something

noli ,

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)
DaforLynx ,

You just dropped a mind bomb on me. Suddenly things make sense :o

shield_gengar ,
@shield_gengar@sh.itjust.works avatar

A monad is just a monoid in the category of endofunctors, what’s the problem?

uis , in Functional bros be like

SSA

gerryflap , in Functional bros be like
@gerryflap@feddit.nl avatar

Ngl, it’d solve a lot of bugs

BaardFigur , (edited )

deleted_by_author

  • Loading...
  • FlorianSimon ,

    Do you have any example in mind? I’m very interested!

    BaardFigur ,

    deleted_by_author

  • Loading...
  • FlorianSimon ,

    Thank you!

    crispy_kilt ,

    Is this some joke I’m too Rust to understand?

    crispy_kilt , in Functional bros be like

    Needs more monads

    Aurenkin , in Every damn time.

    Stupid code! Oh, looks like this was my fault again…this time

    ObviouslyNotBanana ,
    @ObviouslyNotBanana@lemmy.world avatar

    Must’ve been chatGPT’s fault

    BeigeAgenda ,
    @BeigeAgenda@lemmy.ca avatar

    My experience is that: If you don’t know exactly what code the AI should output, it’s just stack overflow with extra steps.

    Currently I’m using a 7B model, so that could be why?

    Spesknight , in Every damn time.

    Computers don’t do what you want, they do what you tell them to do.

    Aurenkin ,

    Exactly, they’re passive aggressive af

    phorq ,

    I wouldn’t call them passive, they do too much work. More like aggressively submissive.

    GregorGizeh ,

    Maliciously compliant perhaps

    They do what you tell them, but only exactly what and how you tell them. If you leave any uncertainty chances are it will fuck up the task

    vzq , in Well....well...well...

    Plot twist: it’s mostly the same guy. And a library from the seventies that had been transpiled from Fortran 4.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines