• (cs) in reply to Anon
    Anon:
    Case-sensitivity is the difference between searching your codebase for five minutes and searching it for three weeks.
    Whatever you are using for "searching your codebase": throw it away!

    A search tool not being able to perform case-insensitive searches is crap. It also is Crap and CRap and CRAp and CRAP! Major CRAP!

  • Anon (unregistered) in reply to Steve The Cynic
    Steve The Cynic:
    The fourth WTF is calling an interface Break.

    Hmm, short easily readable interface name? Check. Interface does what its name says it dies? Check.

    Where's the problem? That an interface that breaks things.

  • (cs) in reply to Valued Service
    Valued Service:
    Not sure if serious:
    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.
    If you break up your code into method calls, you cannot use "break" in that methods!
  • (cs)

    All of this relates to:

    http://www.lysator.liu.se/c/bwk-on-pascal.html

    The title of which is "Why Pascal is not my favorite language". One can infer that since Delphi is derived from Pascal, it too would be on Brian W. Kernighan's list.

    History may prove him correct.

  • Valued Service (unregistered) in reply to no laughing matter
    no laughing matter:
    Valued Service:
    Not sure if serious:
    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.
    If you break up your code into method calls, you cannot use "break" in that methods!

    sigh

    foreach (var entry in records) { entry.MarkInactive(); ActiveEntryIndex.Remove(entry); InactiveEntryIndex.Add(entry); var email = EmailerService.CreateInactiveEntryEmail() { ... } }

    or

    foreach (var entry in records) { MoveEntryToInactive(entry); SendAlertEmail(entry); }

  • (cs) in reply to Valued Service
    Valued Service:
    no laughing matter:
    Valued Service:
    Not sure if serious:
    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.
    If you break up your code into method calls, you cannot use "break" in that methods!

    sigh

    foreach (var entry in records) { entry.MarkInactive(); ActiveEntryIndex.Remove(entry); InactiveEntryIndex.Add(entry); var email = EmailerService.CreateInactiveEntryEmail() { ... } }

    or

    foreach (var entry in records) { MoveEntryToInactive(entry); SendAlertEmail(entry); }

    Completely missing my point: "Not sure if serious" argues that break in loops with 1000s lines of code is bad style because you will not notice that there is a break modifying the loop condition.

    I argue that this is a) wrong (you can search for "break" (case-insensitive!) in that 1000 lines) and your point to break up that code only shows that the code is bad quality and should be restructured anyhow.

    If you do this restructuring, you must however find a replacement for that break.

    So it's not the break that is the problem, it is the 1000 lines of code in the loop.

    break-ing loops is not a bad practice in itself, but if your code is so complicated that it needs to be refactored, you need to replace it with something different.

  • (cs) in reply to Anon
    Anon:
    Steve The Cynic:
    The fourth WTF is calling an interface Break.

    Hmm, short easily readable interface name? Check. Interface does what its name says it dies? Check.

    Where's the problem? That an interface that breaks things.

    The problem is that, even if you're using C or C++ (where Break is still a keyword), it will still screw things up. TRTWF is Microsoft picking such a horrible interface name in the first place.

  • (cs) in reply to Steve The Cynic
    Steve The Cynic:
    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;

    Incorrect. The parenthesis are optional in this case. It's correct to invoke the function with or without parens.

    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;

    That's a feature, not a bug. TRWTF is case sensitivity. The identifier is the same word no matter how it's capitalized, and case insensitivity means you can't pollute your namespace with abuses of case sensitivity. It drives me up the wall when I see someone doing something like this in C code: HWND hwnd;

    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.

    Break is not a procedure, and it's difficult to imagine how it could be implemented as one. It's a compiler-magic directive that, like most of the basic language, is placed in the System namespace by default. This mis-mapping isn't confusing at all if you understand how Delphi's module system works, but considering the number of outright mistakes in your comments, it's clear you don't understand anything about Delphi and you think it's just old-school Pascal with some something-or-other added in.

  • (cs) in reply to herby
    herby:
    All of this relates to:

    http://www.lysator.liu.se/c/bwk-on-pascal.html

    The title of which is "Why Pascal is not my favorite language". One can infer that since Delphi is derived from Pascal, it too would be on Brian W. Kernighan's list.

    History may prove him correct.

    If you're going to bring up history, let's look at Kernighan's history. As the author of the definitive book on C programming, with a direct financial stake in the success of the language, he can hardly be trusted as an objective source of information about C's biggest (at the time) competitor in the programming language space.

  • Vlad Patryshev (unregistered)

    I don't think it is the kind of problem the author thinks it is.

    Get a little bit above the situation.

    Yes, a developer has the right to introduce some kind of dsl; break is one of the keywords of that new dsl.

    Whether the reader, as the author of this wtf, is able to understand the other person's code is the other story. And of course the original author might have kept in mind that new generations of ignorant idiots will come over and start laughing at what they don't grok. That's life, too.

  • anonymous (unregistered) in reply to Mason Wheeler
    Mason Wheeler:
    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;

    That's a feature, not a bug. TRWTF is case sensitivity. The identifier is the same word no matter how it's capitalized, and case insensitivity means you can't pollute your namespace with abuses of case sensitivity. It drives me up the wall when I see someone doing something like this in C code: HWND hwnd;

    That is an excellent idea. Also, all similar-looking characters should be interchangeable in variable names: hello, hell0, helIo, helI0, hel1o, hel10, heIlo, heIl0, heIIo, heII0, heI1o, heI10, he1lo, ... all the same variable name. And since they're not case sensitive, heiio, heii0, etc.

  • (cs) in reply to Anon
    Anon:
    Steve The Cynic:
    The fourth WTF is calling an interface Break.

    Hmm, short easily readable interface name? Check. Interface does what its name says it dies? Check.

    Where's the problem? That an interface that breaks things.

    I know that it breaks, but to say that it dies is a bit dramatic.

  • Anomaly (unregistered)

    The reason case sensitivity matters: Polish polishers polish Polish polishings.

    Polish - someone from poland. polish - makes things shiny.

    Lets say I have a rock polishing company in poland.

    I want to implement a system to give priority to polish Polish rocks over polishing international rocks.

    It gets a little confusing without case sensitivity to infer meaning.

  • (cs) in reply to anonymous
    anonymous:
    Mason Wheeler:
    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;

    That's a feature, not a bug. TRWTF is case sensitivity. The identifier is the same word no matter how it's capitalized, and case insensitivity means you can't pollute your namespace with abuses of case sensitivity. It drives me up the wall when I see someone doing something like this in C code: HWND hwnd;

    That is an excellent idea. Also, all similar-looking characters should be interchangeable in variable names: hello, hell0, helIo, helI0, hel1o, hel10, heIlo, heIl0, heIIo, heII0, heI1o, heI10, he1lo, ... all the same variable name. And since they're not case sensitive, heiio, heii0, etc.

    How could your pedantic statement leave out digraphs?!?!?!?!?!

  • (cs) in reply to Anomaly
    Anomaly:
    The reason case sensitivity matters: Polish polishers polish Polish polishings.

    Polish - someone from poland. polish - makes things shiny.

    Lets say I have a rock polishing company in poland.

    I want to implement a system to give priority to polish Polish rocks over polishing international rocks.

    It gets a little confusing without case sensitivity to infer meaning.

    We're talking about variables and keywords, not string values. It's completely different.

    Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.

  • Bitboy (unregistered) in reply to ObiWayneKenobi

    My MacBook Pro would like a word with you.

  • (cs) in reply to Anomaly
    Anomaly:
    Lets say I have a rock polishing company in poland.
    Oh, the irony.
  • (cs) in reply to Bitboy
    Bitboy:
    My MacBook Pro would like a word with you.

    He said "computer", not "PlaySkool toy."

  • Remy Lebeau (unregistered) in reply to Medinoc

    No, Delphi is not case-sensitive.

  • plaga (unregistered)

    I'll bet the famed Oracle of Delphi predicted this....

  • Remy Lebeau (unregistered) in reply to Kuba
    Kuba:
    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.

    So have you, apparently. Delphi.NET was discontinued several years ago. .NET/CLR support is now handled by a completely different product named Delphi Prism, which is a Visual Studio add-on based on RemObjects Oxygen.

  • (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.

    Although I agree with the first part of not being able to imagine a legit reason to use Delphi (yes - I'm a reformed Delphi guy), the idea of having something preinstalled doesn't gel.

    Delphi actually compiles to native binaries. You don't need a runtime in order to execute a Delphi app like you do with C# or Java. So, the fact those are preinstalled - and likely out of date - is meaningless.

    For me, the reason I don't program with Delphi anymore boils down to a serious number of bad releases (all of the even numbered ones sucked monkey balls) and bugs in their core libraries that persisted through at least version 8 when I left the fold. One quick example is that every other language had easy to use IP communications built in. As of D8, what they had was of such crap that no one ever used it - and that is a pretty f*ckin basic library.

  • Pentiumą00 (unregistered) in reply to Anomaly
    Anomaly:
    I want to implement a system to give priority to polish Polish rocks over polishing international rocks.

    It gets a little confusing without case sensitivity to infer meaning.

    And yet, you would not like code that use "Polish", "polish" and "POlish" to name different variables/procedures.

    OTOH, maybe I should start naming variables and functions with names like "Print", "Echo" and so on. That would make the resulting code fun to read... printf("%s %s", PrintF(HWND), Var); Printf(var);

    (One of the reasons I prefer Delphi/Pascal over other languages is the fact that the identifiers are not case sensitive).

  • Tux "Tuxedo" Penguin (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.

    Nah, using break breaks program as we've seen today, but when using continue, they'll continue to work!

  • Remy Lebeau (unregistered) in reply to clively
    clively:
    One quick example is that every other language had easy to use IP communications built in. As of D8, what they had was of such crap that no one ever used it - and that is a pretty f*ckin basic library.

    If you are referring to the TTCPClient and TTCPServer components of CLX's Sockets unit, then I totally agree. Those components are total crap. However, the original TClientSocket and TServerSocket components of the VCL's ScktComp unit are still available (though they have to be installed manually if you still want to use them), and also Indy (http://www.indyproject.org) has been bundled in every version of Delphi since v6.

  • (cs) in reply to Mason Wheeler
    Mason Wheeler:
    herby:
    All of this relates to:

    http://www.lysator.liu.se/c/bwk-on-pascal.html

    The title of which is "Why Pascal is not my favorite language". One can infer that since Delphi is derived from Pascal, it too would be on Brian W. Kernighan's list.

    History may prove him correct.

    If you're going to bring up history, let's look at Kernighan's history. As the author of the definitive book on C programming, with a direct financial stake in the success of the language, he can hardly be trusted as an objective source of information about C's biggest (at the time) competitor in the programming language space.

    You might try reading the article. I have, and his points are very good.

  • Gerry (unregistered) in reply to foo

    Break IS part of Delphi - it is used to exit from loops (for, while or repeat) early - similar to its use in C and other {languages} . It isn't however part of "Standard Pascal" as defined by Wirth.

  • Gerry (unregistered) in reply to Gene Wirchenko

    As have I (a while ago)- However AS I KNOW Delphi, I know almost all of his criticisms are no longer relevant. Many may not have been relevant when it was written, he just didn't know the language well enough, but I haven't worked in standard Pascal since the mid 80s so I can't remember!

    e.g. Delphi has

    • Pointer arithmetic
    • dynamic arrays
    • a powerful string type which isn't prone to buffer overruns
    • break/continue and exit statements
    • while there are no static local variables, a private class field can be used (single instance in program). There is also a method using the oxymoronically name "assignable typed constants" which annoys many purists.
    • type casting
    • too many others to mention
  • David (unregistered) in reply to ___
    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?

    It's the difference between sExchange() and SexChange()

  • Cheong (unregistered) in reply to Steve The Cynic

    You actually missed one thing: The language uses "end" in some cases without matching "begin" statement.

  • (cs)

    Yeah well... what you do expect from a language that is derived from a language designed by a guy whose last name is roughly pronounced as "weird"?

  • Jerome (unregistered) in reply to ;

    Looks like it's time to get your eyes tested.

  • Free Pascal Lazarus FTW! (unregistered) in reply to Not sure if serious
    Not sure if 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)

    That means an extra test on each pass of the loop, slowing things down. A break out of the loop may be inelegant but would be quicker :)
  • Free Pascal Lazarus FTW! (unregistered) in reply to Free Pascal Lazarus FTW!
    Free Pascal Lazarus FTW!:
    That means an extra test on each pass of the loop, slowing things down. A break out of the loop may be inelegant but would be quicker :)
    Maybe a good compiler would optimize the test-each-time approach so it wouldn't matter... probably by using the exact same breakout method!
  • My first newsletter (unregistered) in reply to anonymous
    anonymous:
    That is an excellent idea. Also, all similar-looking characters should be interchangeable in variable names: hello, hell0, helIo, helI0, hel1o, hel10, heIlo, heIl0, heIIo, heII0, heI1o, heI10, he1lo, ... all the same variable name. And since they're not case sensitive, heiio, heii0, etc.
    That is a terrible idea. All fonts should be distinguishable. hello, hello, hello, hello, hello Hell, all typefaces should be distinguishable. <damm, can't do typefaces in BBCode> Never mind... hello, hello, hello, hello, hello
  • Rob (unregistered)

    It's not possible to add just "break" in the source that will refer to the Word (automation) DLL function "break". "Break" is a part of an interface and there should be above something like:

    With MyWordInstance do Begin -->Break;

  • Dartmoor C (unregistered) in reply to Gerry
    Gerry:
    As have I (a while ago)- However AS I KNOW Delphi, I know almost all of his criticisms are no longer relevant.

    Equally interesting, his praise for C is no longer relevant:

    *library functions are ported into the compiler for improved code generation

    *linking is ported into the compiler for improved code generation

    *there is a standard C library

    *restrictions are placed on the use of pointers for improved code generation

    *declarations are used for improved safety

    The two languages have converged: modern C (and C++ even more) is Pascal-like in an effort to get something like Pascal-like efficiency, portability, and safety.

    Of course not everyone uses C and C++: C# and Java show what happens when you converge to BASIC instead of Pascal.

  • (cs) in reply to Anomaly
    Anomaly:
    The reason case sensitivity matters: Polish polishers polish Polish polishings.
    So this is Polish Object-Oriented Programming?
  • Andy (unregistered) in reply to Steve The Cynic
    Steve The Cynic:
    The fourth WTF is calling an interface Break.
    The fifth WTF is that this interface seems to be known and used. I found this "Interface: Break" while searching the web for the GUID:

    http://svn.codehaus.org/groovy/modules/scriptom/trunk/scriptom-office-2k3/src/main/java/org/codehaus/groovy/scriptom/tlb/office/word/Word.java

  • (cs) in reply to Dartmoor C
    Dartmoor C:
    Of course not everyone uses C and C++: C# and Java show what happens when you converge to BASIC instead of Pascal.
    BASIC is nothing like C# or Java. In fact, Java merged C++ and Smalltalk (insufficiently).
  • (cs) in reply to Severity One
    Severity One:
    Yeah well... what you do expect from a language that is derived from a language designed by a guy whose last name is roughly pronounced as "weird"?

    Niklaus Wirth was once asked how to pronounce his name, and replied, "If you call me by name, it is Neeklaws Veert, but if you call me by value, it is Nickle's Worth".

  • foo AKA fooo (unregistered) in reply to Mason Wheeler
    Mason Wheeler:
    Anon:
    Where's the problem? That an interface that breaks things.
    The problem is that, even if you're using C or C++ (where Break is still a keyword), it will still screw things up.
    int Break = 42;
    works for me.
    TRTWF is Microsoft picking such a horrible interface name in the first place.
    That's nevertheless true.
  • foo AKA fooo (unregistered) in reply to Bitboy
    Bitboy:
    My MacBook Pro would like a word with you.
    I don't think it would like MS Word, with or without you.
  • foo AKA fooo (unregistered) in reply to mendel
    mendel:
    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.
    Joke of the week. Delphi is (and always was) as compatible to ISO Pascal as MS DOS was to POSIX.
  • (cs) in reply to Mason Wheeler

    "Break" (uppercase B) is not a keyword in C/C++. "break" (lowercase b) is. Since C and C++ are not shitty enough languages to be case-insensitive, importing Word typelibs into C/C++ would not give any issues.

    As for the people saying "hurr durr you can use Delphi to create .NET applications" - you can also masturbate with a cheese grater, which is about as pointless, but a far less painful experience.

  • Tux "Tuxedo" Penguin (unregistered) in reply to foo AKA fooo
    foo AKA fooo:
    mendel:
    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.
    Joke of the week. Delphi is (and always was) as compatible to ISO Pascal as MS DOS was to POSIX.

    It is, however, compatible with Turbo- and Borland Pascal code. Which didn't used break as keyword.

    Captcha: similis. This interface name is so similis to standard Pascal construct that it hurts.

  • foo AKA fooo (unregistered) in reply to Tux "Tuxedo" Penguin
    Tux "Tuxedo" Penguin:
    foo AKA fooo:
    mendel:
    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.
    Joke of the week. Delphi is (and always was) as compatible to ISO Pascal as MS DOS was to POSIX.

    It is, however, compatible with Turbo- and Borland Pascal code. Which didn't used break as keyword.

    (a) wrong, (b) irrelevant. Thanks for playing.

  • (cs)

    i am not getting this wtf.

  • anonymous (unregistered) in reply to My first newsletter
    My first newsletter:
    anonymous:
    That is an excellent idea. Also, all similar-looking characters should be interchangeable in variable names: hello, hell0, helIo, helI0, hel1o, hel10, heIlo, heIl0, heIIo, heII0, heI1o, heI10, he1lo, ... all the same variable name. And since they're not case sensitive, heiio, heii0, etc.
    That is a terrible idea. All fonts should be distinguishable. hello, hello, hello, hello, hello Hell, all typefaces should be distinguishable. <damm, can't do typefaces in BBCode> Never mind... hello, hello, hello, hello, hello
    So we agree, both ideas were terrible.
  • anonymous (unregistered) in reply to ___
    ___:
    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?
    If you're using a programming language that's retarded enough to think they're the same, at least your editor should enforce that you may only use one way of capitalising it when it refers to the same thing (i.e. VB).

Leave a comment on “Breaking Delphi”

Log In or post as a guest

Replying to comment #:

« Return to Article