• (cs) in reply to Tyler
    Tyler:
    Except that this looks like PHP, in which case using more than one ternary produces unexpected results. http://www.phpsadness.com/sad/30
    What is this "this" you refer to? Certainly not the submitted code.
  • Bigfield (unregistered)

    Developers! Developers! Developers! <clap clap clap> Developers! Developers! Developers! http://youtu.be/8To-6VIJZRE

  • (cs)

    We actually have this line in our source code:

    pvLegPInst.getFunctor().getFunctor().getFunctor().setScalar(scalingFactor);
    
  • (cs) in reply to Deezil

    D'oh!

    I have no idea what this code should do (or should not do) ;-)

  • pantsman (unregistered)

    In Haskell this is a one-liner. We just use lens composition.

  • TheSHEEEP (unregistered)

    I get the intention of the code, but wouldn't it be much easier to simply return data?

  • pto (unregistered)

    Data data I don't love you you don't love me.....

  • (cs) in reply to Cbuttius
    Cbuttius:
    pvLegPInst
    Gesundheit.

    What is it with programmers and their insistence on abbreviating things enormously? The great vowel shortage is over! Twitter and SMS messaging are producing vast numbers of spare vowels for virtually nothing; there's no excuse for us to not take up this opportunity!

  • Bill Collins (unregistered)

    Data data data data Batman!

  • Raghu (unregistered)

    You ain't got no DATA if the frist data is null!

  • Kasper (unregistered)

    Why did nobody point out that the real WTF is the second if condition, which can never be true?

  • TheSHEEEP (unregistered)

    Huh?

    Each condition is possible.

  • Herwig (unregistered) in reply to Deezil

    Wenn Fliegen hinter Fliegen fliegen, fliegen Fliegen hinter Fliegen her.

  • losty (unregistered)

    data data data LORE

  • Dave Bowman (unregistered) in reply to mightybaldking
    mightybaldking:
    Joey:
    Holy hell, doesn't anyone use ternarys anymore? Gosh!
    var srcData = data;
    return data.data && data.data.data ? data.data.data : data.data ? data.data : data ? data : null;

    That's just beautiful.

    My God, it's full of data!

  • ysg (unregistered)

    badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger badger

  • Chris A (unregistered) in reply to Berend
    Berend:
    Badger badger.badger(); Badger badger = Badger badger + Badger badger; badger.badger.badger ? badger.badger : mushroom
    I am amazed that that took 45 posts.:-)
  • chfexcel (unregistered) in reply to Gumby
    [image]

    An excellent waste of chickhen... and data.

  • seriously? (unregistered) in reply to Deezil

    ^ A wtf in itself

    Captcha: genitus - brilliant genitals

  • TC (unregistered) in reply to Deezil

    Malkovich malkovich malkovich, malkovich malkovich. Malkovich malkovich. Malkovich!

  • (cs) in reply to Joey

    That can be simplified actually:

    data = data.data ? data.data.data ? data.data.data : data.data : data;
    
  • ryan j (unregistered)

    Calling bullshit this was ever serious production code. Hell, even Javascript's Use Strict returns an error if you try to use data.data ferchrissakes.

  • ryan j (unregistered)

    Calling bullshit this was ever serious production code. Hell, even Javascript's Use Strict returns an error if you try to use data.data ferchrissakes.

  • JJ (unregistered) in reply to shepd
    shepd:
    Gary. Gary! Gary gary, gary. HAHAHAHA GARY! Gaaaarrryyyy! No. Gary???

    Also, 101 + 7 = 108.

    You either played it, or you didn't.

    As long as it wasn't 34. 34 was hell.

  • PRMan (unregistered) in reply to Berend
    Berend:
    Badger badger.badger(); Badger badger = Badger badger + Badger badger; badger.badger.badger ? badger.badger : mushroom

    Is this the University of Wisconsin version? (On driving to an office across the street from their campus, the directions were literally "right on Badger, right on Badger, right on Badger and you're there...")

  • valetudo (unregistered) in reply to Herwig
    Herwig:
    Wenn hinter Fliegen Fliegen fliegen, fliegen Fliegen Fliegen nach.

    HDFDGF

  • Indrigis (unregistered)

    A somewhat minor example from the system I used to support.

    Sub SetProp(CardData, Alias, Value, DisplayValue)
    Prop(CardData,Alias).Value("Value")=Value
    Prop(CardData,Alias).Value("DisplayValue")=DisplayValue
    End Sub

    That's an internal language as far as I remember.

  • Chris A (unregistered)

    Any excuse to post this...

    [image]
  • dork (unregistered) in reply to Deezil

    lol, thats just silly... perhaps then it should have been

    String return; if(buffalo.buffalo.buffalo == Buffalo.buffalo.Buffalo) { return = buffalo.Buffalo.buffalo; } else { return = Buffalo.buffalo.Buffalo; } return return;

  • Neil (unregistered)

    OK, so as we all know the original else if code can be written with the ternary operator as follows:

    data = data.data && data.data.data ? data.data.data : data.data ? data.data : data;
    I came up with three ways of rewriting it. This one most closely resembles the original code:
    data = data.data && data.data.data || data.data || data;
    This one looks deceptively similar:
    data = data.data && (data.data.data || data.data) || data;
    The subtle change makes it the easiest one to extend to add an additional level and/or null-check data:
    data = data && (data.data && (data.data.data && (data.data.data.data || data.data.data) || data.data) || data);
    This less readable alternative is the shortest I could come up with:
    data = data.data ? data.data.data || data.data : data;
    It is also amenable to a null-check:
    data = data && data.data ? data.data.data || data.data : data;
    CAPTCHA: a ratis eating my spaghetti code

  • cousteau (unregistered)

    Spam spam spam spam spam spam baked beans spam spam spam

  • Joby (unregistered)

    You know, I think the REAL WTF isn't this code.

    It's whatever it's getting it's input from, which apparently can't be consistent with whether it spews out [Object].data or [Object].data.data

    This snippet actually strikes me as the work of an overworked programmer who late in the game discovered that sometimes their data source nests its data another layer deeper in the object it returns.

    My point is, don't blame the poor bastard dealing with [Object].data.data, blame whoever cursed him with such crazy-ass and apparently inconsistent outputs to work with.

  • Hidden Windshield (unregistered)

    Hastur? Hastur Hastur. Hastur Hastur, Ha$#%$A%+++NO CARRIER

  • ctd (unregistered)
    var srcMalkovich = malkovich;
    if (malkovich.malkovich && malkovich.malkovich.malkovich) {
        malkovich = malkovich.malkovich.malkovich;
    } else if (malkovich.malkovich) {
        malkovich = malkovich.malkovich;
    }
     
    if (!malkovich) {
        return;
    }
  • iWantToKeepAnon (unregistered)
    Data, data. Data data? Data. Data! Data data data, data data… data.

    ... it's BACON!

    CAPTCHA: luctus (came up in my text field prior entered list, hmmm... a CAPTCHA WTF?)

  • (cs) in reply to I am the night.
    causa:
    Joey:
    Holy hell, doesn't anyone use ternarys anymore? Gosh!
    var srcData = data;
    return data.data && data.data.data ? data.data.data : data.data ? data.data : data ? data : null;

    Batman!

    Fucking brilliant. (omg now i can't help humming it)

    Santo subito ! / Feature this ! / whatever you use to declare something awesome...

  • big picture thinker (unregistered) in reply to big picture thinker
    big picture thinker:
    Tyler:
    Except that this looks like PHP, in which case using more than one ternary produces unexpected results. http://www.phpsadness.com/sad/30

    Could be an old version of PHP. That blog is undated.

    Might also have to do with the way they define TRUE and FALSE in PHP. Normally it should be:

    #define FALSE 0 #define TRUE (!FALSE)

    But this is not universal. I would suggest trying that test again with something more explicit like:

    <?php echo (1 == 2 ? "a" : 1 == 2 ? "b" : "c")."\n"; echo (1 == 2 ? "a" : 1 == 1 ? "b" : "c")."\n"; echo (1 == 1 ? "a" : 1 == 2 ? "b" : "c")."\n"; echo (1 == 1 ? "a" : 1 == 1 ? "b" : "c")."\n"; ?>

    Also, you could try using parentheses to enforce order of operation:

    <?php echo (1 == 2 ? "a" : (1 == 2 ? "b" : "c"))."\n"; echo (1 == 2 ? "a" : (1 == 1 ? "b" : "c"))."\n"; echo (1 == 1 ? "a" : (1 == 2 ? "b" : "c"))."\n"; echo (1 == 1 ? "a" : (1 == 1 ? "b" : "c"))."\n"; ?>

    I've used multiple stacked ternary expressions plenty of times in PHP with expected results.

    Follow-up. I tested this just now and yes, the problem does still exist. The solution is to use the parentheses on each "sub" expression.

    Since I always used parentheses in my ternary expressions anyway, I never realized that there were problems if you omit the parentheses. PHP makes me sad.

  • codereview (unregistered) in reply to Deezil

    Malkovich, Malkovich! (reference)

  • tom (unregistered)

    This is called "code as data", you morons :)

  • Kirjat (unregistered)

    ok, how do you like this one:

    
    BOOST_FOREACH(const auto &point, inspectionPoints)
    {
      if (point.first.first.first<=pos.first && point.first.second.first>=pos.first 
          && point.first.first.second<=pos.second && point.first.second.second>pos.second)
      { /*...*/
    
  • Norman Diamond (unregistered)

    http://msdn.microsoft.com/en-us/library/3d6wt21y(VS.90).aspx Deployment in Visual Studio Property Property (Folders)

  • Bartholomew Taps (unregistered) in reply to Kirjat
    Kirjat:
    ok, how do you like this one:
    
    BOOST_FOREACH(const auto &point, inspectionPoints)
    {
      if (point.first.first.first<=pos.first && point.first.second.first>=pos.first 
          && point.first.first.second<=pos.second && point.first.second.second>pos.second)
      { /*...*/
    

    Basically lisp.

  • Alex (unregistered)

    no need for var SrcData ? :)

  • Mike (unregistered) in reply to neminem

    I am Groot. I am Groot. I am Groot? I AM GROOT. I am GROOT! ...I am Groot.

  • Hugh (unregistered)

    Data? Tada!

  • jp (unregistered)

    Reading this made me sing the star wars theme song. Daataa data daataa data data

  • online casino hiring 2018 (unregistered)

    Many individuals who play onlin or live casino games get tjeir start with slots. It's no surprise that should function aas the case, aas sots are likelyy the easziest game much more about and realise.

    People posses played roulette have always aspired too come i'll carry oon with a strategy thaat is correct perfectly. Unfortunately, no it makes me wonder really ask a strrategy this is a hunrred percent effective. If you play roultte online, you may bee able to find a software called roulette sniper. However, even it doesn't really guarantee you november 23 all the time. Alll it really does is record every spin and where the ball might failure. It will show you a pazttern of hhow yoou can win. An individual have to understand that roulette is a gamme of luck and there's no such thing aas a pattern of luck.

    Caribbean Stud is a number of. In this game, everyone plays wirh casino or house, which acts forr a dealer. The house pays out all winning bets. November 23 a round of Caribbean Stud, a gamer must beat only the dealer's hand and the sqauad inn video game do not contend between each other.

    An casino game of roulette can work just appearing a real life game undoubtedly.

    This wil involve predicting when a ball will lasnd on the spinning tyre. When playing online you should see the wheel employed. It sholuld take advantage of the numbers 1 to 36 on itt with 0 and 00 spots.

    A casino is an internet casio is a casino, but you're dealing with the INTERNET here. It's much easier for an sky777 new slot to anish with your bankroll from the joint across the street. This doesn't appear with regard too a concerning issue though, juist stick with the major players and you are fine. It doesn't hurt to do a little "Googling" when yoou never know what you discover.

    When you log on and seloect the table of yyour choice, you possess the screen names of all the players participating with you on the family table. A large boxx at the left side surface off the screen can

  • hydroxchloroquin (unregistered)

    chloroquinine https://chloroquineorigin.com/# hydro clore quinn

  • cialis without a doctor prescription (unregistered)

    https://cialiswithdapoxetine.com/ generic cialis

  • fastest delivery of cialis (unregistered)

    https://cialiswithdapoxetine.com/ cialis without a doctor prescription

Leave a comment on “Data? Data data. Data.”

Log In or post as a guest

Replying to comment #:

« Return to Article