As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/
We're funding a new Acquisitions Incorporated series on Kickstarter right now! Check it out at https://www.kickstarter.com/projects/pennyarcade/acquisitions-incorporated-the-series-2

[Programming] Kafkaesque rabbits in the queue at the pub

17677798182100

Posts

  • InfidelInfidel Heretic Registered User regular
    bowen wrote: »
    Is that some weird shorthand for array length/contents == 0 ?

    Nope, that's just how type coercion works.

    If you have an object and are comparing to a string or number, it converts the object to a primitive. For arrays, it does this via .toString(), which is implemented as .join(), which concatenates all elements into a string using the specified separator, which is the default comma in this instance.

    So [].toString() => "", ["cat", "dog"] => "cat,dog" etc.

    When you compare a string and a number, which you're now at, you coerce the string into a number.

    "" => 0

    0 == 0

    TRUE!

    OrokosPA.png
    ecco the dolphin
  • ecco the dolphinecco the dolphin Registered User regular
    edited April 2017
    I always thought it was [] == false == 0?

    Edit: well I got told

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • bowenbowen How you doin'? Registered User regular
    fuck your face javascript

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
    kimeOrcaCarpyLD50DisruptedCapitalist
  • MadPenMadPen San DiegoRegistered User regular
    That's horrendous. So are Java UIs. I always liked Java's interoperability with C/C++ a little better than C#'s, though. Deterministic resource management is not one of C#'s many shining bright spots.

    3DS: 4098-4243-6127
  • InfidelInfidel Heretic Registered User regular
    If you really want to go down this rabbit hole.

    How I navigated that table "Loose equality using ==":

    Object on the left to Number on top, ToPrimitive(Object) == Number.

    ToPrimitive(Object) is a String, use the table again.

    String on the left to Number on top, ToNumber(String) === Number.

    So ToNumber(ToPrimitive([])) === 0, which is true.

    OrokosPA.png
  • InfidelInfidel Heretic Registered User regular
    I always thought it was [] == false == 0?

    Edit: well I got told

    False is actually on the other side of 0.

    [] == "" == 0 == false

    [] == false would use the table result of ToPrimitive(A) == ToNumber(B).

    ToPrimitive([]) == ToNumber(false)

    "" == 0

    And we know the rest from there.

    OrokosPA.png
  • InfidelInfidel Heretic Registered User regular
    This is not actually a problem because I don't allow == in code reviews. :snap:

    OrokosPA.png
    admanbSpawnbrokerecco the dolphin
  • ecco the dolphinecco the dolphin Registered User regular
    Infidel wrote: »
    I always thought it was [] == false == 0?

    Edit: well I got told

    False is actually on the other side of 0.

    [] == "" == 0 == false

    [] == false would use the table result of ToPrimitive(A) == ToNumber(B).

    ToPrimitive([]) == ToNumber(false)

    "" == 0

    And we know the rest from there.

    Holy shit and we thought C++ was arcane

    Penny Arcade Developers at PADev.net.
    MadPenOrca
  • CampyCampy Registered User regular
    Job interview 2 1 went well today. Recruiter seems to reckon they'll be sending me an offer. They'll decide by Friday.

    Gives me a lot more confidence going into the next few.

    Praise Honky!

    ecco the dolphinMadPenUselesswarriorSporkAndrewurahonky
  • MadPenMadPen San DiegoRegistered User regular
    edited April 2017
    Question: any folks out there work at places where screaming "FUCK!" at the top of your lungs and then punching walls is considered acceptable behavior?

    I'm trying to figure out if that was a 90's thing, or an "awful startup I would never work for at my age" thing.

    edit: I'm not passing judgement on punching walls, just on the startup I worked for where it was fairly normal.

    MadPen on
    3DS: 4098-4243-6127
  • UselesswarriorUselesswarrior Registered User regular
    MadPen wrote: »
    Question: any folks out there work at places where screaming "FUCK!" at the top of your lungs and then punching walls is considered acceptable behavior?

    I'm trying to figure out if that was a 90's thing, or an "awful startup I would never work for at my age" thing.

    edit: I'm not passing judgement on punching walls, just on the startup I worked for where it was fairly normal.

    Awful startup full of high stress and low emotional maturity.

    Hey I made a game, check it out @ http://ifallingrobot.com/. (Or don't, your call)
    ecco the dolphinOrcamightyjongyoCarpySporkAndrewurahonkyOghulka5ehrenthatassemblyguy
  • mightyjongyomightyjongyo Sour Crrm East Bay, CaliforniaRegistered User regular
    If you say Yocto enough times you forget what you're talking about

    yocto. yocto yocto embedded gumstix yocto yocto

    ecco the dolphina5ehren
  • UselesswarriorUselesswarrior Registered User regular
    The Google Site Reliability Engineer book is really good so far, https://landing.google.com/sre/book.html.

    It's free and if your running / managing servers it's probably worth looking at.

    This chapter, https://landing.google.com/sre/book/chapters/embracing-risk.html, is essential reading if you want some help explaining to business or clients why their ask of 99.999% uptime, while cool on paper, is completely impractical.

    Hey I made a game, check it out @ http://ifallingrobot.com/. (Or don't, your call)
  • ecco the dolphinecco the dolphin Registered User regular
    If you say Yocto enough times you forget what you're talking about

    yocto. yocto yocto embedded gumstix yocto yocto

    Open embedded BB recipes patch yocto yocto yocto

    Penny Arcade Developers at PADev.net.
    a5ehren
  • dporowskidporowski Registered User regular
    urahonky wrote: »
    Infidel wrote: »
    Javascript has multiple return values AND undefined! Pick your poison! :rotate:

    Ohh, and null !== undefined, but null == undefined.

    This just reminded me of the face I made when I found out that in Ruby, nil was an object. And as a result, checking if something is nil doesn't work like you figured it would.

  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    is there any valid technical reason why javascript is the scripting language of the browser and not literally any other language on earth

  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    Jasconius wrote: »
    is there any valid technical reason why javascript is the scripting language of the browser and not literally any other language on earth

    is this a joke

  • OrcaOrca Also known as Espressosaurus WrexRegistered User regular
    Jasconius wrote: »
    is there any valid technical reason why javascript is the scripting language of the browser and not literally any other language on earth

    It's an artifact of history, sort of like why C and C++ are used so widely despite being awful languages.

    LD50
  • hippofanthippofant ティンク Registered User regular
    edited April 2017
    Jasconius wrote: »
    is there any valid technical reason why javascript is the scripting language of the browser and not literally any other language on earth

    Well, it was shabbily designed in a rush, is inconsistent and full of nonsense, has grown exponentially in an uncontrolled manner into a massive chaotic spiderweb, and is a basic necessary evil for anybody doing work on the Web.

    So really, it sounds perfect for the Web, doesn't it?

    hippofant on
    OrcaEchoInfideladmanb
  • LD50LD50 Registered User regular
    It certainly is a product of it's environment. So is PHP, and they're similar in a lot of painful ways.

    Orca
  • OrcaOrca Also known as Espressosaurus WrexRegistered User regular
    On a more humorous note, this is pretty entertaining: https://aphyr.com/posts/342-typing-the-technical-interview

    (also consider the first of the series: https://aphyr.com/posts/340-reversing-the-technical-interview )

    EchoDelzhand
  • EchoEcho ski-bap ba-dapModerator mod
    edited April 2017
    Feels like I'm maybe doing something weird here but it also felt like a decent way to make sure you can only use predefined values and not just any string. Or at least have to think about why you're suddenly casting a string to something else.

    edit: it's for JSON responses, so I don't want any random string.
    type errorType string
    
    const (
    	errorNotFound      = errorType("notfound")
    	errorMalformedBody = errorType("malformed")
    )
    
    func newError(status errorType, err error) []byte {}
    

    Echo on
  • zeenyzeeny Registered User regular
    edited April 2017
    Orca wrote: »
    On a more humorous note, this is pretty entertaining: https://aphyr.com/posts/342-typing-the-technical-interview

    (also consider the first of the series: https://aphyr.com/posts/340-reversing-the-technical-interview )

    Knowing what you work with I would have expected the 2nd one(hexing) to be the one you find most fun.
    Aphyr is a great guy using a great language ;o)

    Edit: https://aphyr.com/posts/341-hexing-the-technical-interview

    zeeny on
    InfidelOrca
  • InfidelInfidel Heretic Registered User regular
    zeeny wrote: »
    Orca wrote: »
    On a more humorous note, this is pretty entertaining: https://aphyr.com/posts/342-typing-the-technical-interview

    (also consider the first of the series: https://aphyr.com/posts/340-reversing-the-technical-interview )

    Knowing what you work with I would have expected the 2nd one(hexing) to be the one you find most fun.
    Aphyr is a great guy using a great language ;o)

    Edit: https://aphyr.com/posts/341-hexing-the-technical-interview

    Hahahaha, wow. Writing JVM code byte by byte?

    Where's the magnetic needle, or the butterfly.

    OrokosPA.png
    Orca
  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    Given that the language of the web was almost Java, I'll be over here thanking the stars that we got JS instead.

    EchobowenSporkAndrewInfidelDisruptedCapitalistMvrck
  • RendRend Registered User regular
    admanb wrote: »
    Given that the language of the web was almost Java, I'll be over here thanking the stars that we got JS instead.

    I would much rather always use java than ever use javascript.

    OrcaGrape ApekimeCarpySageinaRage
  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    Nah

    InfidelDisruptedCapitalist
  • OrcaOrca Also known as Espressosaurus WrexRegistered User regular
    Rend wrote: »
    admanb wrote: »
    Given that the language of the web was almost Java, I'll be over here thanking the stars that we got JS instead.

    I would much rather always use java than ever use javascript.

    Or, more specifically, JVM bytecode.

    There are a lot more languages than just Java that use the JVM. And Java itself isn't awful to use these days.

    SageinaRage
  • RendRend Registered User regular
    admanb wrote: »
    Nah

    You're more than welcome to like js or hate java, but man I hate js.

    It's like the concentrated nexus of everything people hate about non-strongly typed languages. If it weren't so ubiquitous I'd avoid it out of hand, but unfortunately I have been forced at various points in my career to do significant work with it. Trivial work is just that: trivial. Eh.

    You put python in a browser and we'll talk. Python is great. But I hate javascript nearly as much as I used to hate visual basic, back when it was even slightly relevant.

    kime
  • OrcaOrca Also known as Espressosaurus WrexRegistered User regular
    Dynamic typing is bad enough. To be weakly typed on top of that means fighting layers of bugs at runtime that other languages can find at compile time--or at least at runtime when you try to do something invalid (e.g. Python). I'm not sure how anybody does anything with JS without using TDD and full code coverage, whereas in a language like Java or C++, I can see how people can put off testing long enough for it to become a pain to deal with. And then there's Haskell, which sometimes works out such that if you can get it to compile, it'll just work...

  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    edited April 2017
    I don't really hate Java, though my reasons against it are a mirror of yours: it's a concentrated nexus of everything I hate about strongly-typed languages.

    I'd much rather a language give me the tools I need to write good code and force me to figure out protections (like using === instead of == in JS) then get in my way at every turn. Especially a language forced into an environment where its development is going to be slowed by external forces. Imagine what Java would be if it didn't just have to deal with the Oracle dev team, but also all the browser dev teams.

    I honestly just don't get the fear people have of weak/dynamic typing. It causes the occasional dumb bug, sure, but for me it's never been more severe then any other dumb bug.

    admanb on
    Infidel
  • CampyCampy Registered User regular
    Interviewed today at an awesome office, open plan, swanky looking, foosball table, the works!

    Full .NET technology stack with an emphasis on code coverage with unit testing, continuous integration, etc.

    Just sent me through an offer that was higher than I was expecting.

    Gonna accept.

    PRAISE HONKY!

    DehumanizedEchokimedjmitchellaurahonkymightyjongyoecco the dolphinSporkAndrewInfidelschussDisruptedCapitalistironsizideMahnmutjjae2123
  • bowenbowen How you doin'? Registered User regular
    C# should replace JS

    C# should replace everything tbh.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
    CampyMadpoetjaziek
  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    bowen wrote: »
    C# should replace JS

    C# should replace everything tbh.

    I won't disagree with this.

    bowenInfidelDisruptedCapitalist
  • SpawnbrokerSpawnbroker Registered User regular
    Typescript is really good and fixes most things I really hate about JS

    Steam: Spawnbroker
    Uselesswarriorjjae2123
  • MadPenMadPen San DiegoRegistered User regular
    admanb wrote: »
    I don't really hate Java, though my reasons against it are a mirror of yours: it's a concentrated nexus of everything I hate about strongly-typed languages.

    I'd much rather a language give me the tools I need to write good code and force me to figure out protections (like using === instead of == in JS) then get in my way at every turn. Especially a language forced into an environment where its development is going to be slowed by external forces. Imagine what Java would be if it didn't just have to deal with the Oracle dev team, but also all the browser dev teams.

    I honestly just don't get the fear people have of weak/dynamic typing. It causes the occasional dumb bug, sure, but for me it's never been more severe then any other dumb bug.

    Man...my thought is "If I want you to perform data conversion on my variable, I'll ask you to do it, thank you very much." If a compiler or interpreter can prevent 20 or 30% of my bugs at the cost of me occasionally having to type "ToString()", I will 100% take that. Not to mention interfaces. Was working with a js guy who told me his front end was displaying garbage because the server was passing him back a garbage string...I forget the exact look of it, but something like "["hi"],["bye"]" and I said, "That's because it's an array of strings". Sidenote: Not sure how you work with js without that being obvious to you, but it horrifies me that that mistake is even possible. Maybe that's more of a JSON issue than JS, though. It's been a while.

    3DS: 4098-4243-6127
    OrcadporowskiCampy
  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    edited April 2017
    MadPen wrote: »
    admanb wrote: »
    I don't really hate Java, though my reasons against it are a mirror of yours: it's a concentrated nexus of everything I hate about strongly-typed languages.

    I'd much rather a language give me the tools I need to write good code and force me to figure out protections (like using === instead of == in JS) then get in my way at every turn. Especially a language forced into an environment where its development is going to be slowed by external forces. Imagine what Java would be if it didn't just have to deal with the Oracle dev team, but also all the browser dev teams.

    I honestly just don't get the fear people have of weak/dynamic typing. It causes the occasional dumb bug, sure, but for me it's never been more severe then any other dumb bug.

    Man...my thought is "If I want you to perform data conversion on my variable, I'll ask you to do it, thank you very much." If a compiler or interpreter can prevent 20 or 30% of my bugs at the cost of me occasionally having to type "ToString()", I will 100% take that. Not to mention interfaces. Was working with a js guy who told me his front end was displaying garbage because the server was passing him back a garbage string...I forget the exact look of it, but something like "["hi"],["bye"]" and I said, "That's because it's an array of strings". Sidenote: Not sure how you work with js without that being obvious to you, but it horrifies me that that mistake is even possible. Maybe that's more of a JSON issue than JS, though. It's been a while.

    I mean that just sounds like your JS guy... sucked. APIs are gonna API and if they're not giving you back the data you expect you're gonna have problems no matter what language you're developing in.

    admanb on
  • OrcaOrca Also known as Espressosaurus WrexRegistered User regular
    I dislike weak typing because I encode information about the correctness of my program in the types I use. In some cases, I'm using the type system to perform computation.

    With strong, static typing I can find out that I'm misusing something by compiling it. With weak, dynamic typing, I find out I'm misusing something when something percolates to the output that looks funny. Or maybe it just randomly fails for some corner case. With strong dynamic typing, misuse is at least highlighted at runtime with an appropriate exception because I'm trying to pass an array into something that expects an integer, or a Foo into something that expects a Baz.

    JasconiusMadPenCampy
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    Orca wrote: »
    I dislike weak typing because I encode information about the correctness of my program in the types I use. In some cases, I'm using the type system to perform computation.

    With strong, static typing I can find out that I'm misusing something by compiling it. With weak, dynamic typing, I find out I'm misusing something when something percolates to the output that looks funny. Or maybe it just randomly fails for some corner case. With strong dynamic typing, misuse is at least highlighted at runtime with an appropriate exception because I'm trying to pass an array into something that expects an integer, or a Foo into something that expects a Baz.

    furthermore, to me, the idea that TDD fixes all of this thus undermines any perceivable advantages of the flexibility and "ease" of javascript

    OrcaMahnmut
  • a5ehrena5ehren AtlantaRegistered User regular
    edited April 2017
    If you say Yocto enough times you forget what you're talking about

    yocto. yocto yocto embedded gumstix yocto yocto

    Open embedded BB recipes patch yocto yocto yocto

    New projects here are ditching our old (decade+) home-rolled build system (python scripts that generate Makefiles, because who wants their builds to go fast?) and Linux stack and going Yocto/OE. It is so much better, holy shit.

    a5ehren on
    ecco the dolphin
This discussion has been closed.