golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.83k stars 17.65k forks source link

proposal: cmd/go: add .ʕ◔ϖ◔ʔ as an alternate spelling of .go in file names #59968

Closed rsc closed 1 year ago

rsc commented 1 year ago

The new (apparently closed-source) programming language Mojo uses files named .mojo, but it allows .🔥 as an alternate spelling of .mojo, as in hello.🔥.

Issue #45549 tracks handling of unicode in import paths, module paths, and file names. We have been proceeding cautiously due to the many subtle issues involved in cross-platform support, case-insensitive file systems, and so on: modules must work equally well on all supported systems.

Clearly Go is being left behind in the Unicode race. We must not let this stand. I propose that we throw caution to the wind and standardize on .ʕ◔ϖ◔ʔ as an alternate spelling of .go, as in hello.ʕ◔ϖ◔ʔ.

The change would be primarily in go/build: .ʕ◔ϖ◔ʔ files would be added to the GoFiles lists. There are probably a few places elsewhere in the toolchain that know the extension .go, such as go tool compile x.go writing out x.o, or VS Code registering .go as the file suffix it supports. These will no doubt be trivial to find.

In #57001, there was some concern about the semantics of Go build tags changing meaning in a subtle way. We could address that by only applying the new semantics in .ʕ◔ϖ◔ʔ files. Older toolchains already have code to ignore those.

There were similar concerns in the discussion #56010 about changing the semantics of for loops. The new .ʕ◔ϖ◔ʔ provides an answer: .go files get the old for loop semantics, while .ʕ◔ϖ◔ʔ get the new semantics.

For long-term migration, go fix can rename .go files to .ʕ◔ϖ◔ʔ

There are a few weeks left before the Go 1.21 freeze. That should be plenty of time for a careful, considered discussion of this proposal and then a complete implementation with no subtle problems. Let's go ʕ◔ϖ◔ʔ!

demo-pzx commented 1 year ago

ʕ👁ϖ👁ʔ ʕ👁ϖ👁ʔ ʕ👁ϖ👁ʔ

784871129 commented 1 year ago

ʕ👁ϖ👁ʔ ʕ👁ϖ👁ʔ ʕ👁ϖ👁ʔ

paralin commented 1 year ago

ʕ👁ϖ👁ʔ

To everyone who thought this wasn't a joke: how did you miss "For long-term migration, go fix can rename .go files to .ʕ◔ϖ◔ʔ" 😂😂

d100972 commented 1 year ago

ʕ⊙ω⊙ʔ

notonlyericy commented 1 year ago

“gopher” is gonna be real gopher 🤓 hhhhhhh

caiyaonan commented 1 year ago

Don't use copy, How to input this symbol

la3rence commented 1 year ago

真会玩😅 再补充两个 swift: . next.js: .▲

as commented 1 year ago

ʕ⊙益ºʔ

interrrp commented 1 year ago

We could probably use 🧪_ instead of test_ too. 🧪_unicode_file_paths.ʕ◔ϖ◔ʔ would absolutely NEVER fail.

CompuRoot commented 1 year ago

Yeah, why strong typed languages, exact meaning definition using alphabet, let's go stone age way

fwielstra commented 1 year ago

We should also build a new filesystem that supports multiline filenames, so we can be even more expressive in file naming.

main. ´.-::::::-.´
  .:-::::::::::::::-:.
  ´_:::    ::    :::_´
   .:( ^   :: ^   ):.
   ´:::   (..)   :::.
   ´:::::::UU:::::::´
   .::::::::::::::::.
   O::::::::::::::::O
   -::::::::::::::::-
   ´::::::::::::::::´
    .::::::::::::::.
      oO:::::::Oo
AriehSchneier commented 1 year ago

I think if this proposal is accepted, we should probably go the full mile and also publish binaries as ʕ◔ϖ◔ʔ.

ʕ◔ϖ◔ʔ run main.ʕ◔ϖ◔ʔ

elegance.

So you suggest we go the full mile and then fell short! Your example should look like:

ʕ◔ϖ◔ʔ 🏃 🦁.ʕ◔ϖ◔ʔ
vcastellm commented 1 year ago

First a request should be raised to include Gopher as an emoji https://unicode.org/emoji/proposals.html

Then: image

CompuRoot commented 1 year ago

First a request should be raised to include Gopher as an emoji https://unicode.org/emoji/proposals.html

Then: image

And the second, - start producing keyboards with emojies

AnthonyMikh commented 1 year ago

I think we should also look into past and adopt .went extension for outdated versions of Go.

lpar commented 1 year ago

We should also build a new filesystem that supports multiline filenames, so we can be even more expressive in file naming.

I have good news regarding Linux and macOS...

package main

import (
    "fmt"
    "os"
    "path/filepath"
)

const filename = `main.
    ´.-::::::-.´
.:-::::::::::::::-:.
´_:::    ::    :::_´
 .:( ^   :: ^   ):.
 ´:::   (..)   :::.
 ´:::::::UU:::::::´
 .::::::::::::::::.
 O::::::::::::::::O
 -::::::::::::::::-
 ´::::::::::::::::´
  .::::::::::::::.
    oO:::::::Oo`

func main() {
    fname := filepath.Join(os.TempDir(), filename)
    fp, err := os.Create(fname)
    if err != nil {
        panic(err)
    }
    fp.Close()

    info, err := os.Stat(fname)
    if err != nil {
        panic(err)
    }
    fmt.Println(info.Name())
}