• Bob Freeman (unregistered)

    break;

  • GvS (unregistered)

    How else would you name a type that represents al kinds of breaks: Column-break, Page-break, section-break.

  • (cs)

    If you're stupid enough to willingly use Delphi 7 (a 10-year-old language/IDE) in 2013, you deserve whatever shit you get.

    tl;dr Oliver T. is a fucking dumbass.

  • (cs)

    The TRWTF is Word OLE Automation. It's a long time since I used it, coincidentally controlled by Delphi, but it was buggy to the point of being unusable. After three months of trying to make it work, I gave up and generated RTF documents instead.

  • Moo Cow (unregistered)

    Break is just a glorified GOTO and therefore evil™.

  • (cs)

    Hurrah!

    I used to understand OLE and now I find I don't !!!

    I'm cured !!!!

    Hurrah !!!

  • (cs) in reply to Moo Cow
    Moo Cow:
    Break is just a glorified GOTO and therefore evil™.
    I particularly like having Column GOTOs and Page GOTOs!

    (You are aware that Dijkstra would not have considered the break control flow construct to be evil? Or are you just one of the legions of parrots who don't understand why he wrote that particular letter and use it as an excuse to commit great harm?)

  • foo (unregistered)

    The language itself is not being broken here because Break is not even part of the Delphi language. It's merely a procedure defined in Delphi's System unit.

    If you were to fully qualify all the calls to Break by changing them to "System.Break", the compiler would ultimately complain about the identifier "Break" being redefined at the point of declaration of the original Break procedure in the System unit. It all depends on the order of unit compilation.

    It's still a WTF, but none that breaks a language.

  • Warren (unregistered)

    You have to give the original developer a break ... he's just used up his last one!

  • ANON (unregistered)

    I don't know anything about Delphi. What is the issue there?

    The programmer wanted to use this procedure: http://www.delphibasics.co.uk/RTL.asp?Name=Break but the linker found this interface instead: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.break_members%28v=office.14%29.aspx Is that correct? Doesn't Delphi have something like packages or namespaces to deal with such issues?

  • ; (unregistered)

    The WTF is a missing semicolon? Lame.

  • (cs)

    I can't imagine any legit reason to use Delphi in this day and age over say .NET or even Java. Maybe when you couldn't be sure of people having .NET installed but nowadays it's standard on every computer.

  • Alex (unregistered)

    So... A DLL overrides a language feature/protected word. Isn't there any way to qualify things?

    (I know nothing when it comes to Delphi)

    Captcha: dolor - Many a consultant were given top dolor and high praise for their part in ensuring job security for most IT people.

  • finally a reason to use Goto! (unregistered)
                  end;
                end;
              Goto Break1;
            end;
    Break1:
            Readln(F, S);
          end;
          CloseFile(F);
        end;
      end;
    end;
    
  • Leonardo Mira (unregistered) in reply to The_Assimilator

    I have worked for a company that still (November 2013) uses Delphi 5 for it's main products (huge ass ERP). A project to build a new version of it' products using Java is ongoing for more than 6 years, and is seriously just around the corner.

  • (cs)

    Wait. Is Delphi case-sensitive?

  • pepito (unregistered)

    breaking bad.

  • (cs) in reply to Moo Cow
    Moo Cow:
    Break is just a glorified GOTO and therefore evil™.

    So flowing through all your case statements is good? Going through every element in your 100000 element array after finding your match at item 2 is good?

  • mendel (unregistered)

    Delphi is a Pascal dialect. "Break" is not a standard Pascal keyword (neither ISO 7185 nor 10206). "Goto" is. To remain compatible, apparently Delphi does not implement "break" as a keyword, either.

  • (cs) in reply to Moo Cow
    Moo Cow:
    Break is just a glorified GOTO and therefore evil™.
    while, for, switch and if else are also glorified gotos, and are also evil™.
  • (cs) in reply to Zacrath
    Zacrath:
    Moo Cow:
    Break is just a glorified GOTO and therefore evil™.
    while, for, switch and if else are also glorified gotos, and are also evil™.
    Exactly. And a procedure is a goto to a fixed address, but at the end it performs a goto to a computed address, which is even eviler™. And don't get me started on object oriented programming!
  • nobody (unregistered)

    Snoofle! You're back! Please go away again.

  • nobody (unregistered)

    Though this is 1000 gimes better than anything you have ever written...

  • Swedish tard (unregistered) in reply to Moo Cow
    Moo Cow:
    Break is just a glorified GOTO and therefore evil™.

    Well trolled. Got at least a few bites out of that obvious one!

  • anonymous (unregistered)

    Break and break are the same thing?

    Case insensitive keywords are TRWTF.

  • ¯\(°_o)/¯ I DUNNO LOL (unregistered) in reply to Zacrath
    Zacrath:
    Moo Cow:
    Break is just a glorified GOTO and therefore evil™.
    while, for, switch and if else are also glorified gotos, and are also evil™.
    Don't forget continue.
  • golddog (unregistered) in reply to pepito
    pepito:
    breaking bad.

    And the rewrite will be done when Oliver T says it's done.

  • Nagesh (unregistered) in reply to nobody
    nobody:
    Snoofle! You're back! Please go away again.

    I lol'd!

  • (cs) in reply to anonymous
    anonymous:
    Break and break are the same thing?

    Case insensitive keywords are TRWTF.

    It's not actually a keyword in Delphi. There are a surprising number of WTFs in this one, one of which is over forty years old!

    Delphi is based on Borland's Object Pascal, which in turn is based on Pascal, as indicated above. The old WTF alluded to above is that Pascal procedure (function returning void) and function calls are written without () if the procedure/function has no formal parameters.

    In C, C++, Java, C#, etc.:

      proc();
      x = func();
      y = variable;
    In Pascal, Object Pascal, Delphi:
      proc;
      x := func;
      y := variable;

    The second WTF is that these lines of code are exactly equivalent in Pascal-like languages because they are not case-sensitive:

      proc;
      Proc;
      PROC;
      pRoC;

    The third WTF is that the call to (apparently) system.break (procedure), also more 1337ly called sYstEm.bReAk (not case sensitive, remember?), somehow got mapped to a reference to the interface named Break.

    The fourth WTF is calling an interface Break.

    That's enough for me.

  • Not sure if serious (unregistered) in reply to DrakeSmith
    DrakeSmith:
    Going through every element in your 100000 element array after finding your match at item 2 is good?

    Not sure if you're joking or serious. Just in case that you are serious: the elegant solution would be to update the loops condition with "and element not found".

    Why is this more elegant? Because if you don't use breaks, you have the guarantee that the negation of the condition holds. The code documents itself.

    while(n < 50 and !eltFound) { //code without breaks } //guaranteed that (n >= 50 or eltFound)

    Alternatively:

    while(n < 50) { //code with breaks } //either n >= 50, or a break was called somewhere in the code that happens to be thousands of lines, because I'm making a point

  • don (unregistered) in reply to Leonardo Mira
    Leonardo Mira:
    I have worked for a company that still (November 2013) uses Delphi 5 for it's main products (huge ass ERP). A project to build a new version of it' products using Java is ongoing for more than 6 years, and is seriously just around the corner.
    I could have written this exact quote about 8 years ago. I don't suppose that product was based on some weird "multi-relational" database, was it?
  • n_slash_a (unregistered) in reply to ¯\(°_o)/¯ I DUNNO LOL
    ¯\(°_o)/¯ I DUNNO LOL:
    Zacrath:
    Moo Cow:
    Break is just a glorified GOTO and therefore evil™.
    while, for, switch and if else are also glorified gotos, and are also evil™.
    Don't forget continue.
    And all function calls, including main(), are also EVIL!
  • (cs) in reply to Steve The Cynic
    Steve The Cynic:
    (tl;dr)

    That's enough for me.

    So in other words, you need to... [dons sunglasses] ...take a break?

    [Cue "Yeaaaaaaaa!"]

  • I forget (unregistered) in reply to anonymous

    Case sensitive keywords are TRWTF.

  • foo (unregistered) in reply to Steve The Cynic
    Steve The Cynic:
    The old WTF alluded to above is that Pascal procedure (function returning void) and function calls are written without () if the procedure/function has no formal parameters.

    Optional parentheses are considered a useful feature in more than one language. Consider Person.Name() vs. Person.Name -- Being able to omit the parentheses in the latter form makes code less cluttered and easier on the eye. To the client, Name looks just like a public field of Person, it might be a field OR a method, and it can be seamlessly refactored from public field to accessor method without breaking client code. I'd call that a feature.

    Steve The Cynic:
    The second WTF is that these lines of code are exactly equivalent in Pascal-like languages because they are not case-sensitive:

    Not a WTF at all, it's just legacy. Borland (and successors) have always done a great job at maintaining backwards compatibility. Modern Delphi is still remarkably consistent despite having accumulated a ton of modern language features in a comparably sane way over the years. Case sensitivity is nice to have, but wasn't considered crucial back in the days.

    Steve The Cynic:
    The third WTF is that the call to (apparently) system.break (procedure), also more 1337ly called sYstEm.bReAk (not case sensitive, remember?), somehow got mapped to a reference to the interface named Break.

    Well, that's the point, as long as you don't understand the "somehow" in "somehow got mapped", how could you possibly judge? In Delphi, this depends on the order of compilation of units. Even if you had qualified all calls to Break as System.Break, the compiler would eventually have complained about your attempt to redefine the identifier "break" at some point. So yes, "somehow", in it's first linear pass, the compiler got confused about how to resolve a symbol. Never happens to any other compiler that gets fed ambiguous code, huh?

    Steve The Cynic:
    The fourth WTF is calling an interface Break.

    Well, it's still the only WTF here.

  • cuu (unregistered)

    no IBreak-puns yet?

  • ___ (unregistered)

    As a non-programmer (but an IT guy!) I don't get the hate for case insensitivity. What's the case for func() and Func() being different functions?

  • (cs) in reply to ObiWayneKenobi

    I don't think it's standard on every computer. Unix? MacOS? AIX? Solaris?

  • (cs) in reply to foo
    foo:
    Steve The Cynic:
    The old WTF alluded to above is that Pascal procedure (function returning void) and function calls are written without () if the procedure/function has no formal parameters.

    Optional parentheses are considered a useful feature in more than one language.

    In Pascal, they aren't optional. They aren't allowed. (Or they were like that in the version I learned Pascal on, way back in the 1980s. It was before the rise of Turbo Pascal. TP3 had just been released, but it wasn't yet widespread enough to be called "rise of".)

    foo:
    Consider Person.Name() vs. Person.Name -- Being able to omit the parentheses in the latter form makes code less cluttered and easier on the eye. To the client, Name looks just like a public field of Person, it might be a field OR a method, and it can be seamlessly refactored from public field to accessor method without breaking client code. I'd call that a feature.
    I'd guess you're a proponent of object properties as found in .NET or Java, then. Or rather, you've just described how they work. The problem is that they carry heavy risks, because you now have invisible function calls that look just like variable accesses and that you can (and by implication will) just switch out at will. The other risk is that when they are invisible function calls, someone will abuse the facility in various ways, as we've seen on this very site many times.
    foo:
    Steve The Cynic:
    The second WTF is that these lines of code are exactly equivalent in Pascal-like languages because they are not case-sensitive:

    Not a WTF at all, it's just legacy. Borland (and successors) have always done a great job at maintaining backwards compatibility. Modern Delphi is still remarkably consistent despite having accumulated a ton of modern language features in a comparably sane way over the years. Case sensitivity is nice to have, but wasn't considered crucial back in the days.

    The fact that people didn't think case sensitivity was crucial doesn't make leaving it out less of a WTF. The main WTF-ness about case-insensitive languages is that they allow the malicious programmer to write code that looks like it is doing different stuff but isn't, because it is accessing importQuantity and Importquantity, and maybe importquantity and IMPORTQUANTITY. Sure, when you work with such a language more and more, you get better and better at ignoring these differences, but that's not the point.

    foo:
    Steve The Cynic:
    The third WTF is that the call to (apparently) system.break (procedure), also more 1337ly called sYstEm.bReAk (not case sensitive, remember?), somehow got mapped to a reference to the interface named Break.

    Well, that's the point, as long as you don't understand the "somehow" in "somehow got mapped", how could you possibly judge? In Delphi, this depends on the order of compilation of units. Even if you had qualified all calls to Break as System.Break, the compiler would eventually have complained about your attempt to redefine the identifier "break" at some point. So yes, "somehow", in it's first linear pass, the compiler got confused about how to resolve a symbol. Never happens to any other compiler that gets fed ambiguous code, huh?

    Well, I'd have to say that if it can still get confused when you explicitly disambiguate the reference (System.Break), then there is something seriously wrong with the whole system.

    foo:
    Steve The Cynic:
    The fourth WTF is calling an interface Break.

    Well, it's still the only WTF here.

  • ANON (unregistered) in reply to foo
    foo:
    Steve The Cynic:
    The second WTF is that these lines of code are exactly equivalent in Pascal-like languages because they are not case-sensitive:

    Not a WTF at all, it's just legacy. Borland (and successors) have always done a great job at maintaining backwards compatibility. Modern Delphi is still remarkably consistent despite having accumulated a ton of modern language features in a comparably sane way over the years. Case sensitivity is nice to have, but wasn't considered crucial back in the days.

    I would imagine that the case insensitivity was even thought to be a feature of the language since it's harder to implement than case sensitivity. That's how times change.

  • Anon (unregistered) in reply to Leonardo Mira
    Leonardo Mira:
    I have worked for a company that still (November 2013) uses Delphi 5 for it's main products (huge ass ERP). A project to build a new version of it' products using Java is ongoing for more than 6 years, and is seriously just around the corner.

    That's like deciding to lose weight by replacing your all-pizza diet with an all-calzone diet.

  • Anon (unregistered) in reply to ANON
    ANON:
    foo:
    Steve The Cynic:
    The second WTF is that these lines of code are exactly equivalent in Pascal-like languages because they are not case-sensitive:

    Not a WTF at all, it's just legacy. Borland (and successors) have always done a great job at maintaining backwards compatibility. Modern Delphi is still remarkably consistent despite having accumulated a ton of modern language features in a comparably sane way over the years. Case sensitivity is nice to have, but wasn't considered crucial back in the days.

    I would imagine that the case insensitivity was even thought to be a feature of the language since it's harder to implement than case sensitivity. That's how times change.

    Case-sensitivity is the difference between searching your codebase for five minutes and searching it for three weeks.

  • Evan (unregistered) in reply to dkf
    dkf:
    Moo Cow:
    Break is just a glorified GOTO and therefore evil™.
    I particularly like having Column GOTOs and Page GOTOs!
    I really really want to see someone do a paper for some English class called "'Choose Your Own Adventure' Books Considered Harmful".
  • (cs) in reply to I forget
    I forget:
    Case sensitive keywords are TRWTF.

    Even VB has case sensitive keywords. It's just the IDE that corrects it for you, and if you don't use an editor that does, the compiler will do it as well.

  • Valued Service (unregistered) in reply to Not sure if serious
    Not sure if serious:
    DrakeSmith:
    Going through every element in your 100000 element array after finding your match at item 2 is good?

    Not sure if you're joking or serious. Just in case that you are serious: the elegant solution would be to update the loops condition with "and element not found".

    Why is this more elegant? Because if you don't use breaks, you have the guarantee that the negation of the condition holds. The code documents itself.

    while(n < 50 and !eltFound) { //code without breaks } //guaranteed that (n >= 50 or eltFound)

    Alternatively:

    while(n < 50) { //code with breaks } //either n >= 50, or a break was called somewhere in the code that happens to be thousands of lines, because I'm making a point

    If your loop is procedurally doing 1000s of lines of code, then you need to break up that code into method calls.

  • (cs)

    Wow -- a whole page of comments yet I'm the first to suggest that using Word is TRWTF?

    Or maybe Word belongs to the sub-level of WTFs that's so horrible as to be beyond mention.

  • Valued Service (unregistered) in reply to cellocgw
    cellocgw:
    Wow -- a whole page of comments yet I'm the first to suggest that using Word is TRWTF?

    Or maybe Word belongs to the sub-level of WTFs that's so horrible as to be beyond mention.

    Working within constraints and requirements is part of the job.

    If you can't manage that, then you're really just a hobbyist programmer, and not a professional.

  • (cs) in reply to Leonardo Mira
    Leonardo Mira:
    I have worked for a company that still (November 2013) uses Delphi 5 for it's main products (huge ass ERP). A project to build a new version of it' products using Java is ongoing for more than 6 years, and is seriously just around the corner.

    Yep, company I was working for 3 years ago had a few legacy products (and their internal ERP system) in Delphi 5. Delphi is still used and is not a wtf at all. Plus the code I've seen in Delphi (and examples online) all seem to be much higher quality than the other possibilities (cough vb6 cough).

    They were in the process of DLLizing the delphi stuff and calling it from .Net since .Net devs are easy to find and Delphi not so much (though it's such an easy language to learn and the ide is pretty usable despite its age). I don't ever remember running into any namespace issues with 3rd party code. I did run into issues with buggy 3rd party libraries, but that's par for the course.

    I wouldn't choose to use Delphi if I were starting something, but definitely no point in scrapping something just because it's in delphi. The one downside was setting up a dev environment from scratch was time consuming (couple days iirc). Luckily the place I had to use it had images of working environments with all the 3rd party tools they used.

  • Loren Pechtel (unregistered) in reply to foo
    foo:
    The language itself is not being broken here because Break is not even part of the Delphi language. It's merely a procedure defined in Delphi's System unit.

    If you were to fully qualify all the calls to Break by changing them to "System.Break", the compiler would ultimately complain about the identifier "Break" being redefined at the point of declaration of the original Break procedure in the System unit. It all depends on the order of unit compilation.

    It's still a WTF, but none that breaks a language.

    Or blow up on you. I crashed the compiler many times by qualifying things with System. (Ported code that had name conflicts.)

  • (cs) in reply to ObiWayneKenobi
    ObiWayneKenobi:
    I can't imagine any legit reason to use Delphi in this day and age over say .NET or even Java. Maybe when you couldn't be sure of people having .NET installed but nowadays it's standard on every computer.
    Future called to let you know that Delphi targets CLR too, so you can use .NET from Delphi just fine. Future as the year 2005 (I'll let the .NET Delphi 8 WTF from 2003 lay undisturbed). So, man, you've been like out of touch with reality for 8 years already.

Leave a comment on “Breaking Delphi”

Log In or post as a guest

Replying to comment #:

« Return to Article