Compiler easter egg





  • @Ben L. said:

    http://play.golang.org/p/eTNfV1BhWr
     

    prog.go:6:35: expected ')', found 'INT' 2 (and 1 more errors)

     



  • @drurowin said:

    @Ben L. said:

    http://play.golang.org/p/eTNfV1BhWr
     

    prog.go:6:35: expected ')', found 'INT' 2 (and 1 more errors)

     


    I said compiler, not autoformatter!



  • Well, that was probably a better use of their time than actually trying to fix Go.



  • @Go said:

    func main() {
        fmt.Println(despiteallobjections 2 + 2 insofaras == 4)

    WTF?



  • @El_Heffe said:

    @Go said:

    func main() {
        fmt.Println(despiteallobjections 2 + 2 insofaras == 4)

    WTF?

    What, does your pet language not have any completely meaningless keywords that exist only so people can make dumb jokes like this?



  • I want DO and PLEASE to be ignored tokens so I can write INTERGOL.



  • @Ben L. said:

    I want DO and PLEASE to be ignored tokens so I can write INTERGOL.
    What would you usefor do..while loops? Only the while condition following a block? I'm cool with that.



  • @Ben L. said:

    @drurowin said:

    @Ben L. said:

    http://play.golang.org/p/eTNfV1BhWr
     

    prog.go:6:35: expected ')', found 'INT' 2 (and 1 more errors)

     


    I said compiler, not autoformatter!

    Compiler? I barely know 'er!


  • Discourse touched me in a no-no place

    @Zecc said:

    @Ben L. said:

    I want DO and PLEASE to be ignored tokens so I can write INTERGOL.
    What would you usefor do..while loops? Only the while condition following a block? I'm cool with that.

    INTERCAL is a joke language. DO isn't a loop construct, it's a statement identifier. All statements start with "do", "please", or "please do". Loops are done with goto (or come from (yes, really)) statements.



  • @FrostCat said:

    @Zecc said:

    @Ben L. said:

    I want DO and PLEASE to be ignored tokens so I can write INTERGOL.
    What would you usefor do..while loops? Only the while condition following a block? I'm cool with that.

    INTERCAL is a joke language. DO isn't a loop construct, it's a statement identifier. All statements start with "do", "please", or "please do". Loops are done with goto (or come from (yes, really)) statements.

    Go only has one looping construct: for. You can give it zero, one, or three statements to execute, and it works like a while(true), while(foo), or for(x;y;z) loop does in other languages.



  • The real WTF is the amount of people on this forum who get butt-hurt over a language they don't even use and don't have to use.



    Go devs have a sense of humor, awesome! I love this language even more now.



  • @JamesKilton said:

    The real WTF is the amount of people on this forum who get butt-hurt over a language they don't even use and don't have to use.



    Go devs have a sense of humor, awesome! I love this language even more now.

    The real WTF is assuming people on the internet are butt-hurt just because they opine aggressively about a subject, when they actually don't give a shit about it at all.



  • @eViLegion said:

    @JamesKilton said:
    The real WTF is the amount of people on this forum who get butt-hurt over a language they don't even use and don't have to use.



    Go devs have a sense of humor, awesome! I love this language even more now.

    The real WTF is assuming people on the internet are butt-hurt just because they opine aggressively about a subject, when they actually don't give a shit about it at all.

     

    I believe you call it "trolling" in English.



  • @FrostCat said:

    INTERCAL is a joke language. DO isn't a loop construct, it's a statement identifier. All statements start with "do", "please", or "please do". Loops are done with goto (or come from (yes, really)) statements.

    INTERCAL doesn't have a goto, intentionally (although it'd be a  more interesting language from the computational model point of view if it had one, IMO). The common ways to do loops are come from, computed come from, and nexting (which is somewhere between a goto and a subroutine call; the original way to do a conditional in INTERCAL was to do some nested subroutine calls and then conditionally decide which one to return from, although computed come from is often simpler, or using Knuth's trick of simply replacing your variables with arrays and having the statements you don't want to do anything affect array elements you aren't using via putting the condition in the array index).

     



  • @drurowin said:

    I believe you call it "trolling" in English.

    I call nothing... YOU call it trolling.



  • @JamesKilton said:

    The real WTF is the amount of people on this forum who get butt-hurt over a language they don't even use and don't have to use.



    Go devs have a sense of humor, awesome! I love this language even more now.

    We're doing our damndest to keep it from GETTING popular, by pointing out how shitty it is, precisely so we'll never have to use it.

    Otherwise, we run the risk of getting hired by a company who wrote some critical product in Go which we now need to support. And sometimes suicide isn't an option.


  • Winner of the 2016 Presidential Election

    @Ben L. said:

    Go only has one looping construct: for. You can give it zero, one, or three statements to execute, and it works like a while(true), while(foo), or for(x;y;z) loop does in other languages.

    All three of the usual arguments to for are optional. So for(;;) works like while(true) [and usually is the syntax I use for loop-until-break, though I try to avoid the pattern], for(;x;) works like while(x) [though it's a WTF to use instead of while(x)]. Go misses three other possible use-cases for for, namely for( x; y; ), for( ; y; z ), and for( x; ; z ).

    (I'm assuming it lacks the two-statement form because you said it took 0, 1, or 3 arguments.)



  • @joe.edwards said:

    @Ben L. said:
    Go only has one looping construct: for. You can give it zero, one, or three statements to execute, and it works like a while(true), while(foo), or for(x;y;z) loop does in other languages.

    All three of the usual arguments to for are optional. So for(;;) works like while(true) [and usually is the syntax I use for loop-until-break, though I try to avoid the pattern], for(;x;) works like while(x) [though it's a WTF to use instead of while(x)]. Go misses three other possible use-cases for for, namely for( x; y; ), for( ; y; z ), and for( x; ; z ).

    (I'm assuming it lacks the two-statement form because you said it took 0, 1, or 3 arguments.)

    You can leave the statements blank. For example, for ;; {} is the same as for {} is the same as for dummy := 0; dummy == 0; dummy = 0 {}.


  • Winner of the 2016 Presidential Election

    @Ben L. said:

    @joe.edwards said:
    @Ben L. said:
    Go only has one looping construct: for. You can give it zero, one, or three statements to execute, and it works like a while(true), while(foo), or for(x;y;z) loop does in other languages.

    All three of the usual arguments to for are optional. So for(;;) works like while(true) [and usually is the syntax I use for loop-until-break, though I try to avoid the pattern], for(;x;) works like while(x) [though it's a WTF to use instead of while(x)]. Go misses three other possible use-cases for for, namely for( x; y; ), for( ; y; z ), and for( x; ; z ).

    (I'm assuming it lacks the two-statement form because you said it took 0, 1, or 3 arguments.)

    You can leave the statements blank. For example, for ;; {} is the same as for {} is the same as for dummy := 0; dummy == 0; dummy = 0 {}.


    So it's practically the same except for the semicolons are optional too.



  • @JamesKilton said:

    The real WTF is the amount of people on this forum who get butt-hurt over a language they don't even use and don't have to use.

    I don't know if I'm butt-hurt, I just hate retarded shit. Whether it's Arrested Development Season 4; anti-gun nutjobs; or Go, I hate things that are shitty and created by dumb people and make the world a much uglier place.

    @JamesKilton said:

    Go devs have a sense of humor, awesome!

    Clearly. After all, they squeezed off this joke of a language.



  • @morbiuswilters said:

    @JamesKilton said:
    The real WTF is the amount of people on this forum who get butt-hurt over a language they don't even use and don't have to use.

    I don't know if I'm butt-hurt, I just hate retarded shit. Whether it's Arrested Development Season 4; anti-gun nutjobs; or Go, I hate things that are shitty and created by dumb people and make the world a much uglier place.

    I hate pro-gun nutjobs. Let's simplify this: gun-related nutjobs are to be hated.

    @morbiuswilters said:

    @JamesKilton said:
    Go devs have a sense of humor, awesome!

    Clearly. After all, they squeezed off this joke of a language.

    There was a presentation that overused the word "boring" and I found that slightly amusing.



  • @joe.edwards said:

    @Ben L. said:
    @joe.edwards said:
    @Ben L. said:
    Go only has one looping construct: for. You can give it zero, one, or three statements to execute, and it works like a while(true), while(foo), or for(x;y;z) loop does in other languages.

    All three of the usual arguments to for are optional. So for(;;) works like while(true) [and usually is the syntax I use for loop-until-break, though I try to avoid the pattern], for(;x;) works like while(x) [though it's a WTF to use instead of while(x)]. Go misses three other possible use-cases for for, namely for( x; y; ), for( ; y; z ), and for( x; ; z ).

    (I'm assuming it lacks the two-statement form because you said it took 0, 1, or 3 arguments.)

    You can leave the statements blank. For example, for ;; {} is the same as for {} is the same as for dummy := 0; dummy == 0; dummy = 0 {}.


    So it's practically the same except for the semicolons are optional too.

    Yeah. I guess the zero-argument form could be grouped with the one-argument form, but while traditionally requires its argument.



  • @Ben L. said:

    There was a presentation that overused the word "boring" and I found that slightly amusing.

    What the hell kind of slide presentation doesn't let you advance slides by clicking the mouse?!
    Oh, right, Go.



  • @Salamander said:

    @Ben L. said:

    There was a presentation that overused the word "boring" and I found that slightly amusing.

    What the hell kind of slide presentation doesn't let you advance slides by clicking the mouse?!
    Oh, right, Go.

    You click on the slide to the right to go to the right. You click on the slide to the left to go to the left. You click on the slide in the middle to...?


  • I am clicking on the slides to the sides. It does nothing.

    EDIT: Ok, so you have to click the gap between the slides. WTF?



  • @Ben L. said:

    Go only has one looping construct: for. You can give it zero, one, or three statements to execute,
    What happens if you give it two statements to execute?  Oh wait, this is Go we're talking about.  I probably don't want to know.



  • @El_Heffe said:

    @Ben L. said:

    Go only has one looping construct: for. You can give it zero, one, or three statements to execute,
    What happens if you give it two statements to execute?  Oh wait, this is Go we're talking about.  I probably don't want to know.


    Depends where you put the semicolons.

    	for foo(); bar() { // syntax error
    
    	for foo(); ; bar() { // execute foo, then loop forever with (the body of the block followed by a call to bar)
    
    	for foo(); bar(); { // execute foo, then loop while bar() is true with the body of the block.
    
    	for ; foo(); bar() { // while foo() is true, loop with (the body of the block followed by a call to bar)
    


  • So apparently one of Go's designers looked at C's for loop and thought "hey, that can do any sort of looping"!

    I daresay that C-style for loops are unneeded in any language with a concept of enumerables and range functions like Python or C#.



  • @MiffTheFox said:

    So apparently one of Go's designers looked at C's for loop and thought "hey, that can do any sort of looping"!

    I daresay that C-style for loops are unneeded in any language with a concept of enumerables and range functions like Python or C#.

    how could I forget!


  • @MiffTheFox said:

    So apparently one of Go's designers looked at a giant pile of crack cocaine and thought "hey, I bet I can smoke all of that at once and then write a programming language"!

    ftfy

     



  • @drurowin said:

    @MiffTheFox said:

    So apparently one of Go's designers looked at a giant pile of crack cocaine and thought "hey, I bet I can smoke all of that at once and then write a programming language"!

    ftfy

     


    TDEMSYR



  • @Ben L. said:

    @drurowin said:

    @MiffTheFox said:

    So apparently one of Go's designers looked at a giant pile of crack cocaine and thought "hey, I bet I can smoke all of that at once and then write a programming language"!

    ftfy

     


    TDEMSYR
    But it makes perfect sense!  Someone abused a copious amount of crack, and then wrote Go.  That's why the general concensus is "it's crackheaded".

     



  • @Salamander said:

    I am clicking on the slides to the sides. It does nothing.

    EDIT: Ok, so you have to click the gap between the slides. WTF?

     

    It might be a scripting error. Did you try disabling your adblocker?

     



  • @MiffTheFox said:

    I daresay that C-style for loops are unneeded in any language with a concept of enumerables and range functions like Python or C#.

    You have the imagination of a blakeyrat. Please never be in a position to make decisions that affect other people.



  • @boomzilla said:

    @MiffTheFox said:
    I daresay that C-style for loops are unneeded in any language with a concept of enumerables and range functions like Python or C#.

    You have the imagination of a blakeyrat. Please never be in a position to make decisions that affect other people.

    Please name for me a non-WTF situation where a for loop is used for anything beyond stuff like for (int i = 0; i < max; i++) or for (int i = max; i >= 0; i -= 2).

    Using for (;foo == bar;) instead of while (foo == bar) is considered a WTF situation.

    I also consider for(;;) for an infinite loop a WTF.



  • @MiffTheFox said:

    @boomzilla said:
    @MiffTheFox said:
    I daresay that C-style for loops are unneeded in any language with a concept of enumerables and range functions like Python or C#.

    You have the imagination of a blakeyrat. Please never be in a position to make decisions that affect other people.

    Please name for me a non-WTF situation where a for loop is used for anything beyond stuff like for (int i = 0; i < max; i++) or for (int i = max; i >= 0; i -= 2).

    Using for (;foo == bar;) instead of while (foo == bar) is considered a WTF situation.

    I also consider for(;;) for an infinite loop a WTF.

    The main thing that comes to mind is altering the list, especially removing items. Usually, any sort of foreach style loop / iterator forbids you from changing the list of items.


  • Discourse touched me in a no-no place

    @MiffTheFox said:

    I also consider for(;;) for an infinite loop a WTF.
    [code]#define EVER ;;[/code]


  • Winner of the 2016 Presidential Election

    @MiffTheFox said:

    @boomzilla said:
    @MiffTheFox said:
    I daresay that C-style for loops are unneeded in any language with a concept of enumerables and range functions like Python or C#.

    You have the imagination of a blakeyrat. Please never be in a position to make decisions that affect other people.

    Please name for me a non-WTF situation where a for loop is used for anything beyond stuff like for (int i = 0; i < max; i++) or for (int i = max; i >= 0; i -= 2).

    Using for (;foo == bar;) instead of while (foo == bar) is considered a WTF situation.

    I also consider for(;;) for an infinite loop a WTF.

    This may or may not tread into WTF territory, but I sometimes write: for( var currentNode = node; currentNode != null; currentNode = currentNode.parentNode ) {

    Though I suppose you could make enumerators for axes like ancestor.


  • Discourse touched me in a no-no place

    @boomzilla said:

    The main thing that comes to mind is altering the list, especially removing items. Usually, any sort of foreach style loop / iterator forbids you from changing the list of items.
    At least some (dunno about most) list implementations have 'safe iterators' which allow such modifications.



  • @MiffTheFox said:

    I also consider for(;;) for an infinite loop a WTF.

    I would have to agree with you. I fucking hate [code]for(;;)[/code]. Which is inevitably followed by some asinine comment like [code]//infinite loop[/code]. Just fucking write [code]while(true)[/code] and maybe an explanation for why the hell you want an infinite loop.



  • @joe.edwards said:

    for( var currentNode = node; currentNode != null; currentNode = currentNode.parentNode ) {

    I actually kinda like that. Think I'll start using it. OTOH, I don't really expect that I'll have to implement a linked list any time in the near future, but still neat.



  • @mikeTheLiar said:

    @joe.edwards said:
    for( var currentNode = node; currentNode != null; currentNode = currentNode.parentNode ) {

    I actually kinda like that. Think I'll start using it. OTOH, I don't really expect that I'll have to implement a linked list any time in the near future, but still neat.

    That's not a linked list! Linked lists don't have parents!



  • @PJH said:

    @boomzilla said:
    The main thing that comes to mind is altering the list, especially removing items. Usually, any sort of foreach style loop / iterator forbids you from changing the list of items.

    At least some (dunno about most) list implementations have 'safe iterators' which allow such modifications.

    That's true, and some have explicit reverse iterators, too. But I don't think most have those. And iterating from end to start is a very valid thing to do, and reversing the whole list for that purpose may not be reasonable.



  • @Ben L. said:

    @mikeTheLiar said:
    @joe.edwards said:
    for( var currentNode = node; currentNode != null; currentNode = currentNode.parentNode currentNode.nextNode ) {

    I actually kinda like that. Think I'll start using it. OTOH, I don't really expect that I'll have to implement a linked list any time in the near future, but still neat.

    That's not a linked list! Linked lists don't have parents!


    Better? parentNode implies some sort of tree, but you can't really for() through a tree. Whatever he's doing up there.


  • Winner of the 2016 Presidential Election

    @mikeTheLiar said:

    parentNode implies some sort of tree, but you can't really for() through a tree. Whatever he's doing up there.

    It's enumerating the self-and-ancestors axis (a la XPath).



  • @mikeTheLiar said:

    I actually kinda like that. Think I'll start using it. OTOH, I don't really expect that I'll have to implement a linked list any time in the near future, but still neat.

    He's traversing up a DOM tree, idiot. There's no linked lists involved there.

    And yeah I've written code like that in the past, but I usually wrap it in a nice-sounding function so it doesn't look so WTFy-- like "FindParentTableNode()" or something.



  • @blakeyrat said:

    He's traversing up a DOM tree, idiot.

    Doh. For some reason JS didn't even occur to me. You're right, that was stupid.



  • @joe.edwards said:

    This may or may not tread into WTF territory, but I sometimes write: for( var currentNode = node; currentNode != null; currentNode = currentNode.parentNode ) {

    Though I suppose you could make enumerators for axes like ancestor.

    That.... that actually makes a lot of sense.

    Certainly more readable then while ((currentNode = currentNode.parentNode) != null).


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.