WTF is the contrary of WTF



  • Sorry for the may-be-obscure title, but I didn't find another way to express this : The WTF feeling we have when confronted to ugly code is, somehow, very similar to the feeling provoked by exotic/excellent/mystic code like this one.

    (with a better explanation here than in the original post)


  • ♿ (Parody)

    Looks like something from the International Obfuscated C Code Contest. Or standard perl.

    `$=`;$_=\%!;($_)=/(.)/;$==++$|;($.,$/,$,,$\,$",$;,$^,$#,$~,$*,$:,@%)=(
    $!=~/(.)(.).(.)(.)(.)(.)..(.)(.)(.)..(.)......(.)/,$"),$=++;$.++;$.++;
    $_++;$_++;($_,$\,$,)=($~.$"."$;$/$%[$?]$_$\$,$:$%[$?]",$"&$~,$#,);$,++
    ;$,++;$^|=$";`$_$\$,$/$:$;$~$*$%[$?]$.$~$*${#}$%[$?]$;$\$"$^$~$*.>&$=`
    


  • @toshir0 said:

    Sorry for the may-be-obscure title, but I didn't find another way to express this : The WTF feeling we have when confronted to ugly code is, somehow, very similar to the feeling provoked by exotic/excellent/mystic code like this one.

    That's ugly shitty code. I don't get your point.



  • @blakeyrat said:

    @toshir0 said:
    Sorry for the may-be-obscure title, but I didn't find another way to express this : The WTF feeling we have when confronted to ugly code is, somehow, very similar to the feeling provoked by exotic/excellent/mystic code like this one.

    That's ugly shitty code. I don't get your point.

    In fact, it is the point. Very "clever" code is shitty as soon as you define "clever" correctly. I'm at a loss for words in english but I'll try to be more precise than this "exotic/excellent/mystic" expression :

    1)  exotic : as boomzilla said, it reminds everyone of ioccc, and makes a perfectly sane language (start flaming here) into brainfuck jam.

    2) excellent : I think we use "excellent" in french slightly differently, and I guess I misused it : I meant (somewhat ironically) "mind-blowing"

    3) mystic : related to the fuckton of LSD taken by the author at the start of this mad construct.



  • Well, I don't get it then. You're saying you get the same emotion from that code than you do from a WTF, then you admit that code is a WTF... so?



  • There are good surprises and there are bad surprises.  There are things that are so good that it makes you cry and there are things that are so bad that it makes you cry.  The emotion in each case is very similar.   That's my impression of what he's trying to say.



  • So if many WTFs are  caused by stupidity or ignorance, this one is reverse : it shows at least (if no sanity) some prowess if you understand me... (but more probably you were just making me explain the whole thing as ruin the effect)(mais la manoeuvre a été exécutée "à la régulière", alors je ne t'en tiendrai pas rigueur, si tu me permets ce détour en français)

    Filed under: Of course I could be totally wrong
    No, El_Heffe, you got it quite right.

     



  • @El_Heffe said:

    There are good surprises and there are bad surprises.  There are things that are so good that it makes you cry and there are things that are so bad that it makes you cry.  The emotion in each case is very similar.   That's my impression of what he's trying to say.

    Well... ok, but... he named two bad things, so--

    Ah fuck it, I'm out of this thread.



  • Also sometimes done in exotic code golf, to try to write a short code that consists entirely of symbols (no alphanumerics), for example. I do anarchy golf, sometimes with this and other kinds of exotic modes, and in many programming languages.


  • ♿ (Parody)

    @zzo38 said:

    Also sometimes done in exotic code golf, to try to write a short code that consists entirely of symbols (no alphanumerics), for example. I do anarchy golf, sometimes with this and other kinds of exotic modes, and in many programming languages.

    What is anarchy golf? Is that just golf with symbols only? The only related thing I could find was this site, which seems to be just about normal code golf.



  •  I dont know; I consider this to be a general WTF given that the language works in a way where evaluation semantics are so recursive. Why are what are essentially string literals interpreted as instructions after the value of the string literal is interpreted?

    Perhaps I'm just too used to languages like C; for instance, the expression

     

    '0x78' '0x3d' '0x35' ;

     

    is most definitely different than the source code

     

    x=5;

     

    It's no wonder there are so many scripting-related security issues when the language inherently allows such complex constructs.  Now don't get me wrong, it's not that complexity is inherently bad, it just increases the methods by which people can abuse the system.



  • @boomzilla said:

    Filed under: anarchy burger
     

    That song just ended as I read your post.



  • @too_many_usernames said:

    Why are what are essentially string literals interpreted as instructions after the value of the string literal is interpreted?
     

    That's not really what's happening here, and your C example wouldn't work in JS.

    This JS effect happens only under very strict circumstances. Strings are only evaluated as instructions when:

    1. They're passed inside brackets: object["member"] === object.member. This is the OP.
    2. within eval(str)
    3. within new Function(str) (which is just eval(), but it gets overlooked at times)

    So just typing '0x78' '0x3d' '0x35' in javascript does absolutely nothing at all.

    What I learned from this: 

    • ~ is an operator in JS. I didn't know it existed. My docs must be out of date. Or maybe I can't read.
    • You can index a string like an array. I didn't know this was possible. My docs must be out of date. Doesn't work in IE7 and lower.
    Which is kinda cool!


  • @dhromed said:

    That's not really what's happening here, and your C example wouldn't work in JS.
     

    Understood; I was generalizing.  Essentially I'm just somewhat intrigued that a string literal (or a computed string for that matter) can be used to represent code elements, not just act as an input into some kind of switch statement or whatever.  I do understand why you would want this feature, but it does leave room for this type of situation.  It is also notably an obvious attack vector, unless there's some protection mechanism that doesn't allow access to members using the array method.

    Although, I think I'd take it one step further, because the OP code doesn't use the token 'object' but rather something that evaluates to 'object.'  I suppose, though, that is just a different facet of the same evaluation rules.


  • ♿ (Parody)

    @too_many_usernames said:

    Essentially I'm just somewhat intrigued that a string literal (or a computed string for that matter) can be used to represent code elements, not just act as an input into some kind of switch statement or whatever.

    It's basically the javascript version of reflection in Java or C# or...well, at least as far back as lisp. Obviously, this is easier to do with interpreted or jitted languages, and not a standard feature of C.



  • @dhromed said:

    1. They're passed inside brackets: object["member"] === object.member. This is the OP.

    2. within eval(str) and setTimeout / setInterval

    3. within new Function(str) (which is just eval(), but it gets overlooked at times)

    Just adding this detail to complete your list...

     



  • @toshir0 said:

    Just adding this detail to complete your list...
     

    Yup yup

    Though I consider it bad form to input a string, and you should use a function ref instead.



  • @dhromed said:

    @toshir0 said:

    Just adding this detail to complete your list...
     

    Yup yup

    Though I consider it bad form to input a string, and you should use a function ref instead.

    Right. Or even an anonymous function for one-shot use, but it should never be used with a string litteral.

     


  • Trolleybus Mechanic

    @boomzilla said:

    What is anarchy golf?
     

    Just like regular golf, except everyone goes at the same time, and it's full contact (including the golf carts)



  • @Lorne Kates said:

    except everyone goes at the same time
     

    Google Wave would have made this possible.



  • @Lorne Kates said:

    @boomzilla said:

    What is anarchy golf?
     

    Just like regular golf, except everyone goes at the same time, and it's full contact (including the golf carts)

    I never watch sports in general. But for this one I guess I just won't be able to resist.

     



  • @boomzilla said:

    What is anarchy golf? Is that just golf with symbols only? The only related thing I could find was this site, which seems to be just about normal code golf.
    That is what is called "anarchy golf". Normally it is not done with symbols only or anything like that, but sometimes they put stuff after their name to indicate these kind of things, such as (sym) for symbols only, (alnum) for alphanumerics only, (alnum=sym) for the equal number of alphanumeric/symbols, (cheat) for cheating entries, and so on. You can put whatever you want in parentheses after your name.


Log in to reply