• (cs)

    eval(Application('WTF').toString()); eval(Application('FIRST').toString());

  • (cs)

    Please don't let this one be true!

  • Nick (unregistered)

    C#? What's with the single quoted strings lol.

  • Smug Unix User (unregistered)

    Just because you can do something doesn't mean you should.

  • (cs) in reply to Nick
    Nick:
    C#? What's with the single quoted strings lol.

    Good catch. Also, the use of toString() instead of ToString().

  • Andreas (unregistered)

    Also, "typeof(openConnObj) == 'undefined'" - that's not C#.

  • TR (unregistered)

    Looks more like Javascript than C#.

  • c# compiler (unregistered)

    I call shenanegans!

  • John (unregistered) in reply to Andreas
    Andreas:
    Also, "typeof(openConnObj) == 'undefined'" - that's not C#.

    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.

  • Josh (unregistered)

    This is clearly JavaScript (which does have an eval function). The authenticity of this entire WTF is in question.

  • Tim (unregistered) in reply to c# compiler
    c# compiler:
    I call shenanegans!
    Seconded
  • Lars-Erik (unregistered)

    I bet he runtime compiled javascript.net.

  • History Teacher (unregistered)

    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!

  • RTFWTF (unregistered)

    If you follow the link with the "eval" examples, it clearly explains that the code you pass to eval should be JScript.

  • (cs)

    Not enterprisey enough. All those naughty hard-coded class definition strings should be in a database...

  • (cs)

    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.)

  • AB (unregistered)

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

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

    Hah. Kids' stuff. I once worked with a processor that could execute a whole array of instructions stored in memory.

  • qbolec (unregistered)

    Thats a modest attempt on DRY principle. You define common methods of objects in one place, and then just mix it in.

  • Barracoder (unregistered)

    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.

  • (cs) in reply to Josh

    Don't worthy, using eval is still a WTF in my book.

  • (cs)

    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.

  • ¯\(°_o)/¯ I DUNNO LOL (unregistered)

    Viva la Inner Platform!

    Also, eval("cornify.js").

  • (cs) in reply to Hatshepsut
    Hatshepsut:
    Hah. Kids' stuff. I once worked with a processor that could execute a whole array of instructions stored in memory.
    Don't be ridiculous. That would be a major security flaw.
  • F (unregistered) in reply to Steve The Cynic
    Steve The Cynic:
    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.)

    Rubbish. The EX instruction modifies one field of the target instruction by a value found in a register. The typical use is where the target instruction has a length field (e.g. a character string move or compare), and the register contains the result of a calculation determining the appropriate length.

    This is a long way from eval().

  • (cs) in reply to pjt33
    pjt33:
    Hatshepsut:
    Hah. Kids' stuff. I once worked with a processor that could execute a whole array of instructions stored in memory.
    Don't be ridiculous. That would be a major security flaw.

    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!

  • Jarrett (unregistered)

    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.

  • (cs) in reply to ¯\(°_o)/¯ I DUNNO LOL
    ¯\(°_o)/¯ I DUNNO LOL:
    Viva la Inner Platform!

    Also, eval("cornify.js").

    Whoever the original creator of that code was, it was obvious that they were the ones who were flying with the rainbow unicorns. Remy has no need to add such tricks this time.

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

    Rubbish. The EX instruction modifies one field of the target instruction by a value found in a register. The typical use is where the target instruction has a length field (e.g. a character string move or compare), and the register contains the result of a calculation determining the appropriate length.

    This is a long way from eval().

    Oops. Mea culpa. I had a dim recollection of an RR mode version (which would have been essentially what I described), but it's been 25 years since I did anything with S/370 assembler language.

  • AmazingPrutsWare (unregistered)

    Can it be that this guy had to port some jave / jscript application to C# and he had exact one day to do it ?

  • (cs) in reply to mott555
    mott555:
    pjt33:
    Hatshepsut:
    Hah. Kids' stuff. I once worked with a processor that could execute a whole array of instructions stored in memory.
    Don't be ridiculous. That would be a major security flaw.

    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!

    Oh come on. What if someone threw it through your datacenter's window? That's hardly secure!

  • Machtyn (unregistered) in reply to John
    John:
    Andreas:
    Also, "typeof(openConnObj) == 'undefined'" - that's not C#.

    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.

    I first read split as spilt...

    You Spilt Java all over my C#!

  • (cs) in reply to mott555
    mott555:
    Please don't let this one be true!

    OK.

    *this[1] = !true;

  • Menno (unregistered) in reply to TR

    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.

  • L. (unregistered) in reply to ¯\(°_o)/¯ I DUNNO LOL
    ¯\(°_o)/¯ I DUNNO LOL:
    Viva la Inner Platform!

    Also, eval("cornify.js").

    I'm pretty sure this wtf is more about being retarded than Inner Platform Effect - but whatever floats your boat.

    The guys had the right mindset (make it flexible), it's just that their implementation ended up quite retarded to say the least.

  • Tim (unregistered) in reply to Steve The Cynic
    Steve The Cynic:
    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.)

    It seems to me that the whole point of a stored program computer (as envisioned by Turing) is that program = data. it's the very programmability that comes from storing the program in memory along with the data which is what makes a computer what it is.

  • Jazz (unregistered) in reply to c# compiler
    c# compiler:
    I call shenanegans!

    Hello? Yes, this is shenanegans!

  • geoffrey, MCP, PMP (unregistered)

    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#.

  • (cs) in reply to AB
    AB:
    Its ToString in C#, and toString in java. Minor, but still....

    And still nobody thinks a case sensitive language is a wtf.

  • geoffrey, MCP, PMP (unregistered) in reply to Weps
    Weps:
    AB:
    Its ToString in C#, and toString in java. Minor, but still....

    And still nobody thinks a case sensitive language is a wtf.

    I do. VB proved that you can build quality software that provides tremendous value without lots of arcane case rules.

  • TheJonB (unregistered) in reply to Weps
    Weps:
    AB:
    Its ToString in C#, and toString in java. Minor, but still....

    And still nobody thinks a case sensitive language is a wtf.

    I aGrEe AlL tHiS cAsE sTuFf Is JuSt StOoOoPiD.

  • SG_01 (unregistered) in reply to geoffrey, MCP, PMP
    geoffrey:
    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#.

    While there are definitely uses for running dynamic code, these are:

    1. Generally not loaded into the same Application Domain as the main application (scripting languages); and/or
    2. Limited in functionality (code based on data)

    They are not:

    1. Fully stored in the application itself; or
    2. Compiled more than once when no changes to the base occur.

    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.

  • (cs) in reply to TheJonB

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

  • (cs) in reply to The Great Lobachevsky
    The Great Lobachevsky:
    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...

    So are you a female bronie?

  • Stilgar (unregistered) in reply to Lars-Erik
    Lars-Erik:
    I bet he runtime compiled javascript.net.

    What he said!

  • (cs) in reply to SG_01
    SG_01:
    geoffrey:
    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#.

    While there are definitely uses for running dynamic code, these are:

    1. Generally not loaded into the same Application Domain as the main application (scripting languages); and/or
    2. Limited in functionality (code based on data)

    They are not:

    1. Fully stored in the application itself; or
    2. Compiled more than once when no changes to the base occur.

    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.

    That's a silly generalization. There's plenty of valid uses for runtime code compilation, and thus for eval-like functions. Of course, ideally you'd want to manipulate some AST data structure directly instead of threading strings together, but as a quick hack feeding strings to eval may be just fine in languages where manipulating the AST is less than trivial. In LISP, eval takes a list that's an AST and there is no string version, so that's not an issue there. You'd use read to convert a string into an AST, but then creating the AST using code is cleaner and simpler than dealing with strings -- LISP is about the only language out there that makes operating on its own AST dead simple.

    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, ...

  • ziubellu (unregistered)

    thai clearly shows that someone really understood the string theory. and he's living in our universe too.

  • (cs)

    Yet another framework, based in insanity and accomplishing everything but the intended goal.

    "There is hardly any language feature that someone cannot use a little worse, and morph into a disastrous enterprisy framework; and those who consider 'enterprisiness' only are that man's legitimate prey."

    (With apologies to John Ruskin.)

  • WTF (unregistered) in reply to Coyne
    Coyne:
    Yet another framework, based in insanity and accomplishing everything but the intended goal.
    "There is hardly any language feature that someone cannot use a little worse, and morph into a disastrous enterprisy framework; and those who consider 'enterprisiness' only are that man's legitimate prey."

    (With apologies to John Ruskin.)

    TRWTF is that John Ruskin wore dresses in his childhood.

    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.

  • LANMind (unregistered) in reply to Steve The Cynic
    Steve The Cynic:
    All use of eval() is automatically a WTF

    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.

Leave a comment on “Pure Eval”

Log In or post as a guest

Replying to comment #376549:

« Return to Article