FAQ
Does anyone have good examples of Go syntax abuse?

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

package main

import "fmt"
var then bool

func main() {
         if _ = true
         then{
                 fmt.Printf("Underscores are true!")
         }else{
                 fmt.Printf("Underscores are false!")}
}

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Kyle Lemons at May 30, 2013 at 9:16 pm
    http://play.golang.org/p/NTJ-AnaPgO

    package main

    import "fmt"

    func main() {
      if despiteallobjections 2 + 2 == 5 {
    panic("Goodbye, cruel world!")
    }
      fmt.Println("Phew, still safe.")
    }

    On Thu, May 30, 2013 at 11:14 AM, Joel Eidsath wrote:

    Does anyone have good examples of Go syntax abuse?

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

    package main

    import "fmt"
    var then bool

    func main() {
    if _ = true
    then{
    fmt.Printf("Underscores are true!")
    }else{
    fmt.Printf("Underscores are false!")}
    }

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Kamil Kisiel at May 30, 2013 at 9:32 pm
    From a bug I recently reported:

    http://play.golang.org/p/zPMdG-kJ4b
    On Thursday, May 30, 2013 11:14:41 AM UTC-7, Joel Eidsath wrote:

    Does anyone have good examples of Go syntax abuse?

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

    package main

    import "fmt"
    var then bool

    func main() {
    if _ = true
    then{
    fmt.Printf("Underscores are true!")
    }else{
    fmt.Printf("Underscores are false!")}
    }
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Rob Pike at May 31, 2013 at 1:14 am
    not an improvement, just an expansion of the idea:

    http://play.golang.org/p/3pNo5hZ0NT

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Daniel Jo at May 31, 2013 at 2:22 am
    I'm seriously confused. Why does the lexer have those symbols?

    -Daniel

    On Thu, May 30, 2013 at 7:14 PM, Rob Pike wrote:

    not an improvement, just an expansion of the idea:

    http://play.golang.org/p/3pNo5hZ0NT

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.


    --
    --Ostsol

    http://cheesesun.blogspot.com/

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • David Symonds at May 31, 2013 at 2:47 am

    On Fri, May 31, 2013 at 12:22 PM, Daniel Jo wrote:

    I'm seriously confused. Why does the lexer have those symbols?
    It's to make Kafka parseable as Go code.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Martin Angers at May 31, 2013 at 12:24 pm
    Haha! Can't test it locally right now, but is it just in the Playground?

    Le jeudi 30 mai 2013 22:47:36 UTC-4, David Symonds a écrit :
    On Fri, May 31, 2013 at 12:22 PM, Daniel Jo wrote:

    I'm seriously confused. Why does the lexer have those symbols?
    It's to make Kafka parseable as Go code.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Minux at May 31, 2013 at 12:39 pm

    On Fri, May 31, 2013 at 8:24 PM, Martin Angers wrote:

    Haha! Can't test it locally right now, but is it just in the Playground?
    It's possible to run locally, but you will have to invoke the toolchain
    directly (instead of using "go run").

    $ cat 3pNo5hZ0NT.go
    notwithstanding package main

    whereas import "fmt"

    func main(thetruthofthematter) {
             if despiteallobjections 2 + 2 == 5 {
                     panic("Goodbye, cruel world!")
             }
             fmt.Println(insofaras "Phew, still safe.")
    }
    $ go run 3pNo5hZ0NT.go
    3pNo5hZ0NT.go:1:1: expected 'package', found 'IDENT' notwithstanding
    $ go tool 6g 3pNo5hZ0NT.go && go tool 6l 3pNo5hZ0NT.6 && ./6.out
    Phew, still safe.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMay 30, '13 at 8:05p
activeMay 31, '13 at 12:39p
posts8
users8
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase