Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I wonder, what's the "weirdest" expression in Go? Here's one:

   type Foo struct{}
   func (Foo) Bar() { println("weird...") }
   func main() {
    ([...]func(){^^len(`
   
   
   `): (&Foo{}).Bar})[cap(append([]any(nil),1,2,3))]()
   }


Makes sense to me, [...]func() is an array of functions, and [...]T{index: value} is uncommon but still perfectly comprehensible


Many people aren't aware that you can use key: val declarations in arrays


That's why I like Rust /s


I have a personal fondness for silly variations of

  type __ *[]*__


this the worst? not too bad. fairly comprehensible.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: