22
b2plane
2y

??????????????????? What??????

???? What???????

I couldnt solve a bug for hours.
Hours of googling.
Hours of mental trainwreck.
Hours of stress.
1:28 am.

I cant solve it.

HOLD ON I HAVE AN IDEA.

ChatGPT AI. HELP ME.

i copy and pasted the part of code thats bugging me. Keep in mind that this is a VERY large and robust system and this is just tiny percentage of code.

I told the AI to help me fix this shit bug.

ChatGPT literally explained me what the bug is as if im retarded and wrote code how to fix it.

LOOK AT THE SCREENSHOT U CANT EVEN MAKE THIS SHIT UP

HOW????

Comments
  • 6
    This shit is crazy. I played around with it the entire day and there was only one thing I couldn't get it to properly code. Everything else it produced functional Rust code first try
  • 0
    @12bitfloat Bro how did elon musk make this. This is insane. Also i can write in my own native language back and forth with the AI. Doesnt even have to be english. So the AI knows every single human language in the world and every single programming language. It can fix a bug that can't even be googled and save hours of time down to a few seconds. How???

    Can some of you AI devs explain this phenomenon
  • 5
    Forgetting to bind a method when using it as an event handler is one of the most classic noob errors in JavaScript (and therefore TypeScript too).

    But it's nice that AI can help finding those now.
  • 1
    @Oktokolo funny enough i never encountered this issue until now and its only because the UI is not updating (while the values do change). I never learned vanilla JS, just typescript and picked up from there
  • 6
    It's impressive, but It's not magic. This sort of issues plague developers since ever. I mean It's because of the stupid language design, the cool thing is not that it generated the answer, that's just pre-learned syntactic chains of hundreds of SO and forum posts. You could make a much less sophisticated AI that would just be good at searching for useful answers based on Input

    Nah, the real cool thing is that you can ask it in human language even if you yourself don't know what the problem is. You could google "how to bind context" and get the same answer in minutes, but since you didn't know what was wrong, It's quite cool it could look at it and interpret it.

    In the end, It's a natural language processing AI, not "programming AI". Keep that in mind.
  • 2
    @b2plane The really bad thing about TypeScript is its dark heritage including all the ugly quirks of JavaScript. You better know the dark side of JavaScript when doing TypeScript. Stuff like this behaving completely different from other languages is just something you have to know or you get bitten by it real hard sooner or later.

    That answer on StackOverflow has 1.2k upvotes: https://stackoverflow.com/questions...

    Another one is the legendarily insane type juggling which looks completely random when you come from other languages. Always test for type and identity explicitly instead of using equality checks. Never assume what type something would become by automatic type juggling as the behaviour seems to be optimized to fool human intuition. Avoid the any type whenever you can. Use unknown for values of unknown type to allow the transpiler to show you type issues.
  • 0
    Quite impressive, thanks for the heads-up!
  • 1
    @Oktokolo well, typescript is a super script of js and while ts is intended to be better its also designed on the concept that all valid js will be valid in ts with all the quirks.

    You can reduce it with linter rules but not eliminate it.

    For the next step of better language in browsers you have to go to one that compiles to wasm but not all languages are available and many are not battle hardened yet.
  • 0
    @12bitfloat where did it fail?
  • 6
    imagine screwing up a language so badly that it's possible to use the wrong `this`.
  • 0
    @tosensei with some reflection magic you can do that in C# also, I know ;)
  • 2
    @Voxera "with some reflection magic" - meaning: by actively trying to break the system, not by using it as intended.
  • 2
    @tosensei this is a fairly good point. If you have to try hard to shoot yourself in the foot, the language is likely built reasonably well.
    But, if right out of the gate, you can hang yourself then there's some danger there.
  • 0
    Fuck ChatGPT, if one day I’ll be unemployed because of IA and forced to eat ze bugs and live in a pod because that’s the only shit I’ll be able to afford with the UBI I’ll blow up myself as close as ai can to OpenAI place.
  • 2
    @DEVil666 don't you think that, if a bot can take your job, you should've done something different in the first place?

    also: don't take screenshots with your camera, thanks.
  • 0
    @tosensei not really trying to but I was doing some quite complex work using reflection and ended up with null reference exception using an int argument to a method since I accessed the method through reflection and forgot to provide an object reference.

    Turns out that arguments to a method in a class are handled as some kind of field of the object. :) as long as I provided an empty new object() as reference it worked but if I provided null it broke even if the method did not access any thing else. It was equal to

    bool IsGreatherThanZero(int a) { return a > 0;}

    And the return threw an exception :)

    That was some fun debugging.
  • 0
    @Voxera

    Class methods are implemented the same in C#, C++ and python.

    They have an implicit first argument called this. When you do instance.method(), the compiler silently prepends instance to the call.

    The reason it may break if you pass null as this (even if you don't access any field/method) is likely because of inheritance, or a debug layer, silently checking super, and breaking.
  • 0
    @CoreFusionX I know, its just that when you do calls through reflection its not always very clear what is happening.

    Once I realized it was a reflection call it was easy :)
Add Comment