Skip to content
  • Categories
  • Recent
  • Tags
  • All Topics
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Caint logo. It's just text.
  1. Home
  2. Uncategorized
  3. TIL that "nil" is not a reserved word in #golang, and this prints '1':```package mainconst nil = 1func main() { print(nil)}```What is this, #PHP in a trench coat?
Welcome to Caint!

Issues? Post in Comments & Feedback
You can now view, reply, and favourite posts from the Fediverse. You can click here or click on the on the navigation bar on the left.

TIL that "nil" is not a reserved word in #golang, and this prints '1':```package mainconst nil = 1func main() { print(nil)}```What is this, #PHP in a trench coat?

Scheduled Pinned Locked Moved Uncategorized
golangphp
4 Posts 3 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Anders EknertA This user is from outside of this forum
    Anders EknertA This user is from outside of this forum
    Anders Eknert
    wrote last edited by
    #1

    TIL that "nil" is not a reserved word in #golang, and this prints '1':
    ```
    package main

    const nil = 1

    func main() {
    print(nil)
    }
    ```
    What is this, #PHP in a trench coat?

    StahlbrandtS 1 Reply Last reply
    0
    • Anders EknertA Anders Eknert

      TIL that "nil" is not a reserved word in #golang, and this prints '1':
      ```
      package main

      const nil = 1

      func main() {
      print(nil)
      }
      ```
      What is this, #PHP in a trench coat?

      StahlbrandtS This user is from outside of this forum
      StahlbrandtS This user is from outside of this forum
      Stahlbrandt
      wrote last edited by
      #2

      @anderseknert Rationale and discussion on this here:

      https://github.com/golang/go/issues/18193

      Dan 🌻D 1 Reply Last reply
      0
      • StahlbrandtS Stahlbrandt

        @anderseknert Rationale and discussion on this here:

        https://github.com/golang/go/issues/18193

        Dan 🌻D This user is from outside of this forum
        Dan 🌻D This user is from outside of this forum
        Dan 🌻
        wrote last edited by
        #3

        @stahlbrandt @anderseknert what a stereotypical set of responses from the go creators, oh my god

        It's like they are intentionally obtusely pretending to not understand the rationale behind the question

        And think disallowing var true = false is a waste of resources because one could simply define var True = false, which isn't a good reason at all

        Predeclared identifiers have a standard meaning, shadowing them to something else is bad, their commentary is wack

        "but the rule is so simple" 🤦

        Anders EknertA 1 Reply Last reply
        0
        • Dan 🌻D Dan 🌻

          @stahlbrandt @anderseknert what a stereotypical set of responses from the go creators, oh my god

          It's like they are intentionally obtusely pretending to not understand the rationale behind the question

          And think disallowing var true = false is a waste of resources because one could simply define var True = false, which isn't a good reason at all

          Predeclared identifiers have a standard meaning, shadowing them to something else is bad, their commentary is wack

          "but the rule is so simple" 🤦

          Anders EknertA This user is from outside of this forum
          Anders EknertA This user is from outside of this forum
          Anders Eknert
          wrote last edited by
          #4

          @danvolchek @stahlbrandt agreed. Having read many threads like that from the past, I’d say that was a pattern. I’m not involved in enough in current development to know if that’s still the case, but FWIW the few times where I’ve interacted with Go devs recently they’ve all been super helpful. I hope that is the current pattern 🙂

          1 Reply Last reply
          1
          0
          • R AodeRelay shared this topic
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • All Topics
          • Popular
          • World
          • Users
          • Groups