Shortest spaghetti ever



  • Language is PL/SQL, where <<>> defines a label:

    goto ok;

    <<ok>>

    There are nearly 150 instances of this pattern in the project I'm working on, so the theory that something has been deleted between those two lines doesn't hold.



  •  I don't suppose in PL/SQL, goto performs some weird trick with threading or transactions or timing or whatever, that was cleverly exploited by the programmer code-ape?



  • Maybe they're trying to make it go faster - making the program jump straight there instead of having to travel through the space in between.



  • @ComputerForumUser said:

    Maybe they're trying to make it go faster - making the program jump straight there instead of having to travel through the space in between.
    Makes sense. If it works for faster-than-light travel in science fiction I don't see why PL/SQL can't benefit from it.



  •  @ammoQ said:

    There are nearly 150 instances of this pattern in the project I'm working on, so the theory that something has been deleted between those two lines doesn't hold.

    Well, unless the original developer(s) used a LOT of cut-and-paste.

     I wonder how these things manage to spread? Maybe one day someone sees it and thinks, "hmmm, I don't understand that, but I'll just copy it anyway because I'm sure it will make my codes work better". Or something.



  • @PhillS said:

    Well, unless the original developer(s) used a LOT of cut-and-paste.

     I wonder how these things manage to spread? Maybe one day someone sees it and thinks, "hmmm, I don't understand that, but I'll just copy it anyway because I'm sure it will make my codes work better". Or something.

     

    Maybe they thought something terrible would happen if a label was reached through the normal control flow instead of a goto.



  • @ammoQ said:

    goto ok;

    <<ok>>
    Someone deleted ur noodles!  Please tell me you're not jamming it without noodles!



  • @ammoQ said:

    There are nearly 150 instances of this pattern in the project I'm working on, so the theory that something has been deleted between those two lines doesn't hold.
     

    Uhh, why not?  The only way they could have got there is massive cut'n'paste abuse, and if somebody's doing that, I certainly wouldn't put it past them to think "Oh, we don't need the error handling anymore, so I'll just delete it - but I don't have time to refactor this properly"!

     



  • You just gave me a really bad idea for a new language: 

    @ammoQ said:

    Language is PL/SQL, where <<>> defines a label:
     

    As opposed to APL/SQL, where ¨¯×÷←↑→↓∆∇∘∣∧∨∪∂∆∏∑√∞Ω⅞∫¾№℅≠☺<wbr>☻☼♫◥▂▃▄▅▆▇█<wbr>▉▊◀◉◊◎␀⋙⊱⋛⋨⌂⊎∮<wbr>↯⁂.∼≠≤≥≬⊂⊃⌈⌊⊤⊥⋆ defines a label?




  • @DaveK said:

    The only way they could have got there is massive cut'n'paste abuse
     

    Oh really? You don't think find/replace could possibly have been a factor?



  • @DaveK said:

    As opposed to APL/SQL, where ¨¯×÷←↑→↓∆∇∘∣∧∨∪∂∆∏∑√∞Ω⅞∫¾№℅≠☺☻☼♫◥▂▃▄▅▆▇█▉▊◀◉◊◎␀⋙⊱⋛⋨⌂⊎∮↯⁂.∼≠≤≥≬⊂⊃⌈⌊⊤⊥⋆ defines a label?


    That's not a label - that's the complete source code for The Matrix (APL is very concise).



  • @MasterPlanSoftware said:

    @DaveK said:

    The only way they could have got there is massive cut'n'paste abuse
     

    Oh really? You don't think find/replace could possibly have been a factor?

     

    No it was probably an update query in Access 



  • there exist shorter spaghetti...

    http://search.japantimes.co.jp/mail/nn20080603f2.html

     

    or at least noodles..



  • @DaveK said:

    As opposed to APL/SQL, where ¨¯×÷←↑→↓∆∇∘∣∧∨∪∂∆∏∑√∞Ω⅞∫¾№℅≠☺☻☼♫◥▂▃▄▅▆▇█▉▊◀◉◊◎␀⋙⊱⋛⋨⌂⊎∮↯⁂.∼≠≤≥≬⊂⊃⌈⌊⊤⊥⋆ defines a label?
     

    You sick man. Go and look at the source code for the A+ interpreter as your punishment. I recommend src/a/f.c which contains the following C code:

    Z H1(rdc){I r,d[9];ND1 r=a->r-1;Q(r<1,7);R mv(d,a->d+1,r),*d*=*a->d,rsh(a,r,d);}
    Z H1(monadicIota){A z;I1;{I r=a->n,*d=a->p,n=tr1(r,d);Q(n<0,9) Q(a->r>1,7)Q(r>MAXR,13)W(ga(It,r,n,d))d=z->p;DO(n,d[i]=i)R(I)z;}}
    Z H1(rav){ND1 R rsh(a,1,&a->n);}
    Z H1(sha){A z;ND1 W(gv(It,a->r))mv(z->p,a->d,a->r);R(I)z;}

     


Log in to reply