• foo2 (unregistered) in reply to KattMan
    KattMan:
    foo2:
    KattMan:
    How is this a problem? Am I suppose to ask the thief if he is there to just take my TV or to kill me, my wife and my little girl? He is there, without permission, already threatening, I am not going to stop and ask questions. You sir, probably take the stance that I am killing him to keep my TV, I take the stance that he risked his life for one when there are safer ways to get one, to bad he lost.

    You sir, should challenge the thief to compare penis sizes. Biggest gets the TV, odds are you'll lose.

    I'd beat both of you, of course, but I don't have much use for a TV.

    It's not about comparing, it's not about who has a tougher attitude. I don't want to fool around with an intruder. If he intelligently takes off back out the door before I get a sight on him I won't pursue. It is about one thing and one thing only, defense of me and my family, nothing more, nothing less.

    You sad, sad little man (Man? Ha hah ah ah ha.)

    First you're all "I'll pop a cap in dat dere ass", now it's "Well, if he leaves then... um..."

    In real life you'd help the thief carry your TV to his car, then go hide under your bed until someone lures you out with your favorite teddy bear.

    PSA: "ITGs in my WTF GoTo thread? It's more likely than you think! Mock them now, and help contain the spread of this moronic disability! Call '555 GOTOWTF' for your free information kit today!"

  • Meep (unregistered) in reply to KattMan
    KattMan:
    I would disagree with this point. "On Error Goto" was not bad, it was just so commonly misused. Think of the "Try Catch Finally" pattern and translate those under the cover jumps to VB6.

    ...

    This works and mimics the Try-Catch-Finally that most people say is just fine. Remember all these are simply Jumps from one code location to another within a particular scope.

    Except that in Try Catch you need to check the error type:

    On Error Goto Catch
    'Do something
    Goto Finally
    :Catch
    Select ErrNum
    Case 1:
      'do stuff
    Default:
      Throw ' Rethrow the error
    End Select
    'Trap your error
    :Finally
    'do some Cleanup
    

    Ah, but we forgot to disable error handling! After all, errors can occur within the catch or finally blocks:

    On Error Goto Catch
    'Do something
    Goto Finally
    :Catch
    On Error Goto -1
    Select ErrNum
    Case 1:
      'do stuff
    Default:
      Throw ' Rethrow the error
    End Select
    :Finally
    On Error Goto -1
    'do some Cleanup
    

    And if we want an actual finally block, we need to allow for returning from the procedure:

    On Error Goto Catch
    If choice Then
       MyFunction = read_file("blah")
       GoSub Finally
       Exit Function
    Else
       ' Do Other Stuff
    End If
    GoSub Finally
    Goto Outside
    :Catch
    On Error Goto -1
    ...
    GoSub Finally
    GoTo Outside
    :Finally
    On Error Goto -1
    ...
    Return
    :Outside
    

    And do you know what the rules are for jumping in and out of loops in VB? How do you handle, e.g. a break statement in a catch "block"? What about the rules for other structures, like Select statements or conditionals?

    The problem with 'goto' is not that dumb programmers make spaghetti code, it's that programmers writing boilerplate makes spaghetti code.

    The On Error approach to exception handling requires a ton of very tricky boilerplate, and even if you don't screw it up, it won't be readable.

  • Rena (unregistered)

    Wow, for the record, the original submission had much better grammar.

  • (cs) in reply to MrBester
    MrBester:
    I'll just leave this here...

    For the lazy, it's a definition of MsoTriStateEnumeration, which is a tri-state Boolean with 5 possible values of which only two are supported. Just let that sink in for a while so you can appreciate the awesome WFTery of it.

    msoWrong

Leave a comment on “Confessions: Hacker Proof Boolean”

Log In or post as a guest

Replying to comment #:

« Return to Article