- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I talked to someone a year ago who was attending classes at MIT who said that for his admissions essay he wrote about a topic not even on the list because he didn't think their topics were interesting.
Admin
Note that this could stack overflow because C doesn't do tail call elimination. This is a one example of why languages that do tail call elimination are so nice, you can break code into functions and do function calls at the end (lots of return foo(); for example) without having to worry about running out of stack space. This is related to the so called "Continuation Passing Style" (CPS).
What you wrote almost looks like CPS, but not quite (exclude the while stuff). Do you really need all those while statements?
Admin
Please crosspost your post in some Delphi forum, I'm sure they will agree fully with you! Please
Admin
<FONT face=Georgia>Warming the Delphi before use is a sure way of messing it up.</FONT>
<FONT face=Georgia></FONT>
<FONT face=Georgia>>BiggBru</FONT>
Admin
True, and copying it that many times adds to the WTFishness.
#46 is a period. The apparent intention was to replace periods with commas, and the requirement to have only one means they're using it as the decimal separator, not thousands separator.
Two other points:
It's "apostrophe", with an H not an I.
Also, Edward Plonk demonstrates his own moronity with his bigoted comments.
Egregiously,
Mr. Egregious
Admin
So, it's called CPS? Ok then, but just because it has a name doesn't mean it's a good thing to do :)
Admin
Yes. My growing girth as a result of age is truly a "waist of time".
Admin
<FONT face=Georgia>Don't make me laugh out loud when I'm in the school library! Now people think I'm crazy! [:P]</FONT>
Admin
Well, my statment was correct as far as the two languages go; environments and libraries not so much. Since "Delphi" can either refer to the enviornment or the language (object Pascal), the statement itself was a little amiguous. What I MEANT was that C++ and object Pascal aren't that different, and they aren't. They are both object oriented and while each has a few concepts that the other lacks (C is a little more streamlined and flexible while Delphi force a little more structure onto the developer, casing notwithstanding), the same basic abilities are there. The devil is in the frameworks/libraries/3rd party tools.
And yes, Delphi's VCL was great, and one of the biggest selling points for the product IMHO.
I doubt any Delphi proponents would seriously disagree with what I've said here.
Admin
I don't know who you were replying to, but you're claiming that C compilers don't transform tail-recursive calls into iterations? If so, you better check your facts. Compilers can and do do this optimizanion. (I hate writing repeated words...) You need to use optimization with both GCC and Sun CC, but both will optimize away the tail call in the canonical tail-recursive version of factorial.
Admin
Am I missing something here?
The value of "selection" is undefined as you enter this loop. The loop will NEVER be executed![:#]
Admin
Ahh yes, quite obvious now.... It was actually quite obvious shortly after I made my post lol. I've seen alot of similar things with VB coders... Those are the kind of people that throw a control onto a form and make it invisible because it has a Picture property and they know no other way to make an object of type picture, or are naive in some other fashion that I can't even begin to imagine
Admin
What I like are jerks who think they are superior to other people because they disdain certain programming languages (speaking as someone who has programmed in a variety of assemblers, Pascal, C, C++, VB, VB.net, Java, and a variety of other languages).
Guess what... VB is a perfectly good language. Works fine. Generates code that runs fine. I wouldn't write a web server in it, but for client-side applications it's a reasonable choice.
Deal with it...
Admin
The inefficiency of this for/case is a minor issue.
"Hard to manage"? I think not. A set of labels are appended to a sequence of statements that only needs to be changed once to impact them all. This strikes me as being less error prone during maintenance that a list of separate assignment statements.
Ok, the actual code may have been more complicated. But as written the for/case has some desirable attributes.
Admin
[|-)]
Admin
Well RFC "Marvin_Rabbit" says that I don't have to accept any mail I don't want to. So Neay!
Admin
Sure, you can reject for any reason you like.
I note that you're not rejecting at HELO time, which is good... many mail servers like to send lots of email messages on the same HELO connection, and they get confused if you reject at HELO.
As long as your rejection message is clear (which it is,) you're RFC-good.
Admin
How often are new "little languages" justifiable at all these days? They're more fun than damn near anything, certainly, but high-quality implementations of useful scripting languages, easily embedded and extensible, are available free off the shelf. Sometimes you need something so domain-specific that nothing existing will do the job, but how often is that, really?
Yacc's cool, though it's a PITA to write a re-entrant parser with it. That state pattern might be objectionable for some applications because of virtual function call overhead, but probably not too often... Sounds like the typing overhead might be more painful.
Admin
NO, Beavis. Wrong. I said that the languages stupid people use are often case-blind (are you seriously claiming otherwise?) Then I said that that's a good thing, because, essentially, stupid people deserve to suffer. If you're stupid and you're trying to transition from a case-blind language to a case-sensitive one, you'll suffer more than you would otherwise. That's all I said. Can't comprehend it, eh?
Why do I get the feeling you're a VB CRUD-monkey who tried to learn C and couldn't cope with pointers?
Admin
For anybody who's not a hopeless drooling idiot, it's not going to matter at all. That's why I said it was only the stupid people who'd suffer.
Delphi was ("was"?! Is it gone now?) surely a lot less godawful than VB. And yeah, while it lacked a lot of the amenities of C++ (templates, operator overloading, the STL that those two make possible, function overloading, class instances as stack variables with destructors called automatically on scope exit, etc. etc.), C lacks those amenities too. And Delphi compiled to real native code, and let you treat bytes as bytes and pointers as pointers, so yes, it was not a toy. It had (or has) bitwise operators too, right?
Not my language of choice, but it deserved better than to languish among the CRUDies.
Admin
It could have been a global variable ( which is possible in Delphi )
Admin
So would that make you Butthead?
tdog
Admin
Delphi has function overloading
Admin
Out of curiosity, have you ever read this article by Paul Graham:
http://www.paulgraham.com/avg.html
(be prepared for rampant lisp-o-philia)
While I have no opinion one way or another on Delphi (having never used it myself) your objections to the (admittedly nastily inflammatory) previous comment sound a little like those mentioned in the "blub paradox". This is not an accusation (as I said, I'm not qualified to judge either way), just a "think about it".
Admin
I'd be interested in takin a crack at the test myself. You should post the actual test.
Admin
2 things: 1) you could (should) have this common code in a method that the events would call. 2) But even more specific to Delphi is that you can assign one event handler to multiple events, so you could just have the one method in your code and have all the labels pointing to the same KeyPress procedure, saving tons of repetative code.
-shnar
Admin
Delphi's ObjectPascal is an extended version of Pascal adding lots of powerful OOP into the language. Delphi's real strength though is the VCL. Easiest comparison is C# and the DotNet runtimes. C# is just syntax, but the real strength is in the libraries. VCL however came out over 10 years ago and was an incredibly advanced way to program for Windows.
And to think that a language makes you a superior coder is just stoopid. If anything, a case-insensitive language produces fewer "silly" bugs than a case-sensitive one. I can't tell you how often I spend debugging other developer's code to find the problem was they were using the same variable name just different casing. Compilers won't catch that, and neither do human eyes, and so lends itself to buggier code.
Experience has taught me that being as explicit as possible is much more important than case-sensitivity in a langauge.
-shnar
Admin
Actually, the C++ programmers say the same thing, at least the ones who use Borland's C++Builder. It used the same VCL libraries after version 3(?) and so effectively the only practical differences between Delphi and C++ was the syntax. Ultimately boiled down to a personal coding preference, do you prefer C++ or ObjectPascal? (though I heard that Delphi projects compiled/built exponetionally faster).
-shnar
Admin
Still around, Borland just released Delphi 2006 (effectively version 10) and has with each version been adding more and more language features. Method overloading exists (since version 5), and they just added operator overloading. Everything else you mention, and you could even add your own Assembly code if you wanted to. It still does compile to real native code, making it still one of the best Win32 programming langauges on the market (especially for business/database applications).
-shnar
Admin
This is getting deep enough that nobody will likely read it, but nobody pointed out that what was meant by "dotting the i's and crossing the t's" wasn't about case, but about naming. When you write a large form with lots of components, its just plain common sense to NAME THEM. And, in Delphi, all you have to do is click on the control, click on the "Name" field over in the property list, and then TYPE A MEANINGFUL NAME and it alters the code in your editor automatically.
Once you've named your components, it makes it much easier to write the code that reads/writes/shows/hides them, and a whole lot easier to debug and maintain.
Also, a few other FYIs about Delphi:
In Delphi, you start (usually) with an empty form, and add components to it, much like VB. The form is a class, and every component you add gets tossed in as a pointer-to-component field. Every event you create gets added as a method. You can add your own fields and methods, and re-use events so long as their prototype matches what is needed. So, where some people were wondering where variables came from, they were likely just private fields of the form class, added with poorly chosen names by the canidate.
Someone suggested subclassing the edit blank. This is possible in Delphi, but not quite practical. If you are willing to create+add the component at runtime (like Java-style), then its no problem. But creating at runtime sucks (as any Java programmer will realize if they've played with Delphi or VB) and its much nicer to have the component serialized with the form, along with its properties and event handlers (which are method pointers, essentially). In order to do this in Delphi, you would need to get your subclass "onto the toolbar" which is done by putting the subclass in a different file and building a package out of it, which turns into a sort of DLL thing that the IDE can load on the fly and then let you use (and edit the properties of) it in the designer. The component's code can then be either staticly or dynamically added to your project. So in other words, people usually only subclass objects if the object is reusable.
Every Borland-made component has lots of "events", however, and these make it very easy to add functionality to an existing class without subclassing, and have the added benefit of being able to use values from fields in your form object. (which otherwise might require you to give a subclassed component a pointer to its parent, so it could access these values)
In short, rather than making 3 handlers & copy-paste, the canidate should have made one handler for the first text blank, and then used the drop-down list on the other two events to select the handler they already wrote.
[ Note: I'm another one of those guys who thinks that the story of Delphi not becoming mainstream is a tragedy for the programmers of the world ;-) You use it like VB, but the interface and component library are implemented better, the language is as low as C and almost as high as Java, with an expressive type system, it compiles faster than anything thanks to its single-pass design, and the syntax is pascal with an OO twist. ...ok, so some people don't like the syntax, heh. ]
Admin
perl -wle 'print map chr, 73,32,102,105,110,100,32,121,111,117,114,32,117,115,101,32,111,102,32,112,101,114,108,32,100,105,115,116,117,114,98,105,110,103,10'
Admin
Is it me or are there a lot of trolls here today? Remember not to feed 'em....
Admin
i = 1;
while ( !selection && i <=13 )
{
selection = s1[i];
i++;
}
Look mom.. No breaks..
Admin
i = 1;
while ( !selection && i <=13 )
{
selection = s1[i];
i++;
}
Damn forum ate my operator..
Admin
I give up..
Admin
...even if it's a HELO from some mysterious host who prefers to call itself "localhost"...
Admin
Yeah, and C++ and Smalltalk aren't that different either. They are both objet oriented and while each has a few concepts that the other lacks (C++ is a damn heap of messy poo while Smalltalk is structured and streamlined) the same basic abilities are there.
Anyone would seriously disagree with what you've said because it's stupid, you basically used the good ol' strawman "my language's Turing Complete and yours is too so they're equivalent".
Admin
Personally (I'm not the original poster of these objections) I would say that C++ programmers are generally more blubby than Pascal programmers. I do most of my coding in Object Pascal, but that doesn't mean I'll promote it as the best language ever and claim that anything else is inferior. Language choice is all about what you want. If you want syntax that is compact and effective (this can be quite beautiful, I'll give you that), go C++. If you want syntax that is intuitively understandable, even for non-programmers, and where the = sign means what it has meant for centuries, go Pascal.
As for functionality.. of course, most (far from all, but most) objections to programming languages stem from ignorance. Many one-language programmers just assume that you can't do certain things in other languages. (I've met the argument, numerous times, that you can't even use inline assembly code in Pascal, something that you have been able to do at least since the ancient Turbo Pascal 6.0.)
Still, I realize that there are things one cannot do in Pascal. If I need such a thing, I use another language for that specific project and temporarily endure its (personally perceived) syntactic ugliness, if any. And I've found that if I really need templates and operator overload (I mostly use FPC and haven't checked out Delphi 2006, so I don't have access to those things), then chances are that I will need to dynamically create classes during runtime as well. And as far as I know (correct me if I'm wrong), I can't do that in C++ either, so I have to switch to an interpreted language like Ruby.
As for the article, I don't doubt that Lisp is a very powerful language (it's been years since I did anything with it, so I don't remember much), but it's certainly not easy to read. So unless I specifically need those powers, I'll stick to something more transparent.
(By the way, first time poster on this infamous forum, so please excuse any formatting madness.)
Admin
I don't know about him, but I am.
To say that "the languages stupid people use are often case-blind" is simply meaningless. Many languages are case-insensitive. Many languages are used by stupid people. There is no correlation, so the statement is not worth making. Anyone who reads TDWTF knows that there are just as many stupid people writing stupid code in C++, Java, and any other case-sensitive language you care to mention, and there are also smart people writing smart code in VB. (Yes, really.)
Therefore, it is patently obvious that there is no connection between case-insensitivity and stupid programmers. Therefore, claiming that a programming language is used by stupid people because it is case-insensitive is stupid, and categorising a language as a "moron language" (as I seem to recall somebody doing) simply because it is case-insensitive is moronical.
You may also like to read up on logical fallacies. Asserting that anyone who uses VB does so because they're, what was it again, "a VB CRUD-monkey who tried to learn C and couldn't cope with pointers", is what we call an "ad hominem" argument. Only idiots and trolls use them. I wonder which you are?
Admin
Very eloquently put, SilverDirk.
I agree whole-heartedly. One of the important features of Delphi that you failed to mention is;
While it compiles in one pass it also creates tight, efficient executable that can run on any Windows system.
No Runtime Libraries (the bane of Visual Basic), no CLR (the .NET 'framework' which is simply MS new version of the bloated runtime libraries). I have successuflly written Delphi applications in the mid 1980's that ran on every available version of Windows (including Windows 3.0) and still run today on XP !
I don't profess to be an authority on any one language (I have written applications in over a dozen different languages) but Delphi has NEVER disappointed me.
Admin
Although your statements are valid. Your tone is a bit troll-ish.[:|]
Admin
You are a clown for lots of reasons....
1. Why bother putting the panels there if they are always going to be invisible?
2. Languages themselves do not make the applications, programmers do. VB has been used with success in lots of places. VB.NET also wipes the floor with your poncy virtual languages.
3. You think you are clever as you are aware that some languages are case sensitive.
4. Why are you reading this forum if it wastes your time and annoys you?
5. But the main reason you are a clown is probably because your father was a clown.
Cheers.
Admin
This technique makes perfect sense if the state could change or ought to change due to some external input.
But yeah if it's just going in a predefined sequence then, well, this is just a reimplementation of the so-called "subroutine" :)
Reed
Admin
Actually, anyone with any Delphi knowledge at all would know that you can assign the same event handler to more than
one control; instead of double-clicking on the control, you just use the dropdown list in the Object Inspector. The "Sender"
parameter to the event handler tells you which control generated the event.
Admin
Apparently, yes. :D
Selection was not declared in the event handler we got to see, so it was apparently declared (and a value defined) elsewhere in the code.
Admin
And in the current version (Delphi 2006), it also has operator overloading.
Admin
And this same employer will call me and wonder why I turn him down when he's offering $40/hr or $60k/year for a Delphi expert.
And then when he asks if I know anyone that might be interested, he'll wonder why I say, "Sorry, I don't know anyone I'd recommend for that price."
Admin
>That's not the WTF, I think. The WTF is that the default control names (panel1, etc) were never changed >when the form or page was developed.
Disagree- the general concensus was that there was no reason to rename a UI element (like a panel) unless you actually addressed it in code. If it was just an element on the form, there's no reason to waste time renaming it- there're often many panels, etc.
The WTF is the inconsistency- false, false, FALSE, false, false... panel, panel, PANELX, panel... Clearly- the one in caps wasn't generated by Delphi- someone had to type PANEL..FALSE because delphi wouldn't generate all caps.
>I think that's VB.NET, BTW.
No, it's definitely Delphi, even VB.NET isn't lame enough to use := when it means =.
Admin
>so maybe the language just requires code like this.
No, this is another case of, "You can write crap in any language." Language can poop.
>Isn't Delphi an OO language?
The language is essentially very close to Java/C# (C# and Delphi had the same guy design them, basically).
>Subclass the edit field object and add a doSomething() method that performs the correct action
Yes you could do that if you wanted-there're better ways than that, but there's no excuse for that crap code, hence the WTF.
Admin
Now THAT is funny! Or did you not intend the irony?