gopherdata / gophernotes

The Go kernel for Jupyter notebooks and nteract.
MIT License
3.85k stars 263 forks source link

Fix print command (closes #5) #16

Closed JoshCheek closed 8 years ago

JoshCheek commented 8 years ago

Took another look at this, and since it's been a little bit of time, a solution was easier to see. Not very fond of the solution, but it's simple enough for now. For the future, seems like a better structure is some sort of an enum of return types, one of which is the current err, another is a String to return, and others potentially arising in the future.

View from the notebook

View from the shell

oskca commented 8 years ago

:+1:

dwhitena commented 8 years ago

Awesome @JoshCheek ! Thanks. Did you test to make sure the other custom commands still function (most importantly :import)?

JoshCheek commented 8 years ago

I didn't, I only relied on the type system and ran the printing code by hand. It's probably worth checking at least one of them out, just in case, it does something wonky. Based on the name "import", that's a good one to check, b/c if it behaves like the C preprocessor, it literally dumps the contents of some file into the source code (IDK if it's a Golang thing, or if it's part of your lib, or how it works, but depending on all that stuff, implications of correctness could change). FWIW, automating tests has been invaluable to me for gaining that kind of confidence.

dwhitena commented 8 years ago

Yeah agreed. And I definitely agree with the automated testing. This is another lacking part of this project, due to how it was born (i.e., out of hackathon).

dwhitena commented 8 years ago

Thanks again @JoshCheek ! This is great. I tested the import functionality and then merged.