Frectonz
I fucken did it. It works, I added a try statement to the go compiler
i am literally shaking, my hands are shaking
π1
Frectonz
This thing is so close to working but the typecheck is failing, after i transform the try statement to a regular if statement. from this try c or string = ioutil.ReadFile(filename) to this content, err := ioutil.ReadFile(filename) if err != nil { varβ¦
So the syntax is not the same as the one i used last time, changed it up a bit to make things easier. Here is the current version, that's working.
so the
1. the error variable
2. the type of the return value (this is needed because go has this convention of returning the zero value of a type incase of an error)
so the above syntax gets expanded into the following
content, err := ioutil.ReadFile(filename)
try err or string
so the
try statement expects two values1. the error variable
2. the type of the return value (this is needed because go has this convention of returning the zero value of a type incase of an error)
so the above syntax gets expanded into the following
if err != nil {
return make([]string, 1)[0], err
}π4
Frectonz
I fucken did it. It works, I added a try statement to the go compiler
I have ascended beyond the mortal plain.
And golang devs you are welcome.
And golang devs you are welcome.
Frectonz
So the syntax is not the same as the one i used last time, changed it up a bit to make things easier. Here is the current version, that's working. content, err := ioutil.ReadFile(filename) try err or string so the try statement expects two values 1. theβ¦
i really wish some of you all could run it and try it out, i am using nix to setup the environment. The readme has instructions to build it from source, if you use nix.
https://github.com/frectonz/better-go/
https://github.com/frectonz/better-go/
GitHub
GitHub - frectonz/better-go: It's go but with try
It's go but with try. Contribute to frectonz/better-go development by creating an account on GitHub.
π8
Frectonz
a story of pain
This is what watching Jonathan Blow clips telling you to do hard stuff does to a person. π
π1
Frectonz
I fucken did it. It works, I added a try statement to the go compiler
Also implemented an
from this
to this
unwrap statement that panics when the error is not nil.from this
unwrap err
to this
if err != nil {
panic(err)
}π8
"Most people die at 25... we just don't bury them until they are 70."
β Benjamin Franklin
β Benjamin Franklin
π13
Frectonz
I fucken did it. It works, I added a try statement to the go compiler
I am thinking of doing a demo of how i added
try and unwrap to the go compiler tonight. So should i just walk through the diff explaining what each part does or should i do a live implementation of a new statement.π6
Frectonz
Missed opportunity π’, I should have thought of this meme then. π
btw don't forget to checkout better-go for your compiler design courses, i am sure you will learn a lot π
Frectonz
Live stream started
Will start of at 4:10, anyone who is interested gather around until then.