- 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
eval(Application('WTF').toString()); eval(Application('FIRST').toString());
Admin
Please don't let this one be true!
Admin
C#? What's with the single quoted strings lol.
Admin
Just because you can do something doesn't mean you should.
Admin
Good catch. Also, the use of toString() instead of ToString().
Admin
Also, "typeof(openConnObj) == 'undefined'" - that's not C#.
Admin
Looks more like Javascript than C#.
Admin
I call shenanegans!
Admin
And the use of .split, instead of Split.
Unless of course said programmer used extension methods for everything, I'm more inclined to believe that TRWTF is not recognising the langauge you're working on.
Admin
This is clearly JavaScript (which does have an eval function). The authenticity of this entire WTF is in question.
Admin
Admin
I bet he runtime compiled javascript.net.
Admin
Hey, this is pure genius. Why hasn't anybody else come up with something like this before? I mean, you can have code as text, and then just... run it! No pesky compilation to get a binary executable. If you want to modify code, just edit it in Notepad, and you can run it right away. Just think how much this could speed up development!
Admin
If you follow the link with the "eval" examples, it clearly explains that the code you pass to eval should be JScript.
Admin
Not enterprisey enough. All those naughty hard-coded class definition strings should be in a database...
Admin
It occurs to me that TRWTF is the anonymiser. And the submitter. It's a Remypost, so you can read more in the HTML comments.
It doesn't make much sense in Java either...
(All use of eval() is automatically a WTF, but apparently this does not go without saying. It's worth noting that eval() is not new as a concept, as an instruction existed in the IBM System/370 instruction set that would execute an instruction found in a register.)
Admin
If you're going to anonymise a story about Java to C#, at least change the method names so they're right.
Its ToString in C#, and toString in java. Minor, but still....
Admin
Hah. Kids' stuff. I once worked with a processor that could execute a whole array of instructions stored in memory.
Admin
Thats a modest attempt on DRY principle. You define common methods of objects in one place, and then just mix it in.
Admin
Dust off and nuke the entire site from orbit. It's the only way to be sure.
Eval as a wrapper around the compiler as a proxy for flexibility? Whoever thought that up needs re-education, China-style.
Admin
Don't worthy, using eval is still a WTF in my book.
Admin
Them functional programmers with their first-class functions building functions to compose functions into other functions have got nothing on these string oriented programmers! Just give them a string and an eval and they will run circles around the heads of anyone.
I especially love how in taking the string oriented programming approach they negate any possible advantage that one might expect out of an IDE, not that that matters since they will be developing so rapidly that the IDE and its fancy features like auto-completion, code refactoring, templates, etc will only get in the way and hamper their creativity.
Admin
Viva la Inner Platform!
Also, eval("cornify.js").
Admin
Admin
This is a long way from eval().
Admin
Definitely a security flaw. That's why I worked with a processor that couldn't execute any instructions ever! It's the most secure computing platform in the world!
Admin
Give it time. With C# 5 and Compiler as a Service, expect to see this in production C# code. It will be crap, and we all know it.
Admin
Admin
Admin
Can it be that this guy had to port some jave / jscript application to C# and he had exact one day to do it ?
Admin
Admin
I first read split as spilt...
You Spilt Java all over my C#!
Admin
OK.
*this[1] = !true;
Admin
The best way to implement Eval in C# would be to import the eval from JScript.NET. The single quotes make perfect sense, in a sad, sad way.
Admin
The guys had the right mindset (make it flexible), it's just that their implementation ended up quite retarded to say the least.
Admin
Admin
Hello? Yes, this is shenanegans!
Admin
Some requirements may call for an engine that can run dynamic code. I challenge anyone to find a better way to do this in C#.
Admin
And still nobody thinks a case sensitive language is a wtf.
Admin
I do. VB proved that you can build quality software that provides tremendous value without lots of arcane case rules.
Admin
I aGrEe AlL tHiS cAsE sTuFf Is JuSt StOoOoPiD.
Admin
While there are definitely uses for running dynamic code, these are:
They are not:
Even AIs that support self-modifying code follow these rules.
TL;DR: Eval is Evil, and like all evil things, you should think thrice if there's not a better solution.
Admin
am I the only one that saw this and thought of Geoff Peterson's Facebook page? :)
anyways, I love how people complain about cornify, and then there are complaints when there isn't one. Personally, I obsessively have to keep clicking until I get the My Little Pony one...
Admin
Admin
What he said!
Admin
Alas, the rare uses I was mentioning would include, I wouldn't know, just-in-time compilers for javascript that are present in almost every web browser out there, CLR and JVM, but that's obvious and those aren't exactly your random enterprisey applications. There are plenty other, widely-deployed uses, though, like JIT-ing shaders (Apple did it to emulate shaders on oldish hardware), generating ideal hashes (used in routers and firewalls), optimizing SQL stored procedures, ...
Admin
thai clearly shows that someone really understood the string theory. and he's living in our universe too.
Admin
Yet another framework, based in insanity and accomplishing everything but the intended goal.
(With apologies to John Ruskin.)
Admin
From Wikipedia: http://upload.wikimedia.org/wikipedia/commons/thumb/c/ca/John_Ruskin_by_James_Northcote.jpg/170px-John_Ruskin_by_James_Northcote.jpg
Ruskin as a young child, painted by James Northcote.
Admin
There's enough supporting comments on this threat for me to assume that this isn't a troll. That being the case, I'd like to point out that just because you can't imagine the use case, doesn't mean that one doesn't exist.