Slide 1

Slide 1 text

: Translating Code to Other (Human) Languages and Back Again @chimeracoder Aditya Mukerjee Systems Engineer, Stripe

Slide 2

Slide 2 text

95% of the world doesn’t speak English as their first language 89% of the world doesn't speak English at all @chimeracoder

Slide 3

Slide 3 text

Software is eating the world @chimeracoder (and Javascript is eating software)

Slide 4

Slide 4 text

@chimeracoder Software is a powerful enabling force Software reflects the people who build it

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

“I would have thought it would be useful to NATO, because they had the common verbs for the things they were going to do. And the nouns, they’d just have to have a dictionary for things they were referring to for inventory control…. They’d have common nouns throughout NATO, and they could make a dictionary of common verbs and translate the program. You could write one in English and you could translate it and it could go to [the other language]. No problem, you’d have communication. It would be a limited vocabulary.” - Grace Hopper @chimeracoder

Slide 7

Slide 7 text

github.com/ChimeraCoder/koro (koro)

Slide 8

Slide 8 text

package main import "fmt" func main() { if true { fmt.Printf(“hello, world!\n") } } @chimeracoder

Slide 9

Slide 9 text

main "fmt" main(){ true { fmt.Println(”hello, world!!\n") } } @chimeracoder

Slide 10

Slide 10 text

@chimeracoder

Slide 11

Slide 11 text

Slide 12

Slide 12 text

gofmt korofmt @chimeracoder

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Automatic source code translation • Bidirectional translation layers • Localize source code as a commit hook @chimeracoder

Slide 15

Slide 15 text

Structuring Code

Slide 16

Slide 16 text

Naming Schemes @chimeracoder readFoo() writeFoo() then() (etc.) foo () foo () () …

Slide 17

Slide 17 text

Could we do this in Javascript?

Slide 18

Slide 18 text

Character encoding Go: • Source code is required by the language spec to be UTF-8 • Strings (and byte arrays) are internally treated as UTF-8 JavaScript: • Source code can have any encoding supported by the interpreter • JavaScript: Strings are internally treated as... uhhh… wait… …what?

Slide 19

Slide 19 text

@chimeracoder

Slide 20

Slide 20 text

Could we do this in Javascript?

Slide 21

Slide 21 text

Could we do this in Javascript? ¯\_()_/¯

Slide 22

Slide 22 text

Localizing Error Messages

Slide 23

Slide 23 text

type error interface { Error() string } @chimeracoder

Slide 24

Slide 24 text

@chimeracoder Cannot cast parameter type from type “System.String” to argument type “System.String” Uncaught SyntaxError: Unexpected token ILLEGAL

Slide 25

Slide 25 text

The only thing worse than a cryptic error message is a cryptic error message in a foreign language that you can’t understand @chimeracoder

Slide 26

Slide 26 text

Where do we go from here?

Slide 27

Slide 27 text

95% of the world doesn’t speak English as their first language 89% of the world doesn't speak English at all @chimeracoder

Slide 28

Slide 28 text

Aditya Mukerjee @chimeracoder https://github.com/ChimeraCoder