Live data from Hacker News

Yaegi – Yet Another Go Interpreter

blog.containo.us

11–20 of 77 posts

Re: Yaegi – Yet Another Go Interpreter

#11
post #3

Programming in a language lacking a repl is always uncomfortable. I always wind up making a 'scratch.{ext}' file and running it to test things (scratch.* is in my global gitignore). Happy an interpreter+repl now exists for Go.

I think this is a matter of personal preference. At work my primary language is Python and I rarely use the REPL, and when I do, it's a regrettable experience--can't use up arrow to get previous command, can't use arrow keys to move cursor, entering tabs after the `. . .` makes it hard to figure out how many tabs to enter, etc. And of course you can't visualize the whole "program" at a glance like you can in a text editor. Not sure if Python's REPL is just subpar among repls or if I just don't understand how to leverage REPLs for my benefit, but `$EDITOR /tmp/foo.py` just works so much better for me.

Re: Yaegi – Yet Another Go Interpreter

#12
post #11
post #3

Programming in a language lacking a repl is always uncomfortable. I always wind up making a 'scratch.{ext}' file and running it to test things (scratch.* is in my global gitignore). Happy an interpreter+repl now exists for Go.

I think this is a matter of personal preference. At work my primary language is Python and I rarely use the REPL, and when I do, it's a regrettable experience--can't use up arrow to get previous command, can't use arrow keys to move cursor, entering tabs after the `. . .` makes it hard to figure out how many tabs to enter, etc. And of course you can't visualize the whole "program" at a glance like you can in a text e…

I prefer a scratch file and send-to-repl. Common in e.f. F#

Re: Yaegi – Yet Another Go Interpreter

#13
post #4
post #3

Programming in a language lacking a repl is always uncomfortable. I always wind up making a 'scratch.{ext}' file and running it to test things (scratch.* is in my global gitignore). Happy an interpreter+repl now exists for Go.

You can do similar things by writing tests as you go, plus then you can keep the tests if they seem useful.

For one meaning of "test", sort of, but repls are useful for far more than "do outputs match what I expect". Test writing is not very good for exploratory programming.

Re: Yaegi – Yet Another Go Interpreter

#15
post #11
post #3

Programming in a language lacking a repl is always uncomfortable. I always wind up making a 'scratch.{ext}' file and running it to test things (scratch.* is in my global gitignore). Happy an interpreter+repl now exists for Go.

I think this is a matter of personal preference. At work my primary language is Python and I rarely use the REPL, and when I do, it's a regrettable experience--can't use up arrow to get previous command, can't use arrow keys to move cursor, entering tabs after the `. . .` makes it hard to figure out how many tabs to enter, etc. And of course you can't visualize the whole "program" at a glance like you can in a text e…

Bpython is much nicer experience than the native repl, but I still really only use it to call help(), __slots__(), etc and test minor things like forgotten syntaxes; the lack of automatic reloading just makes it to irritating to work on the script itself that way

Re: Yaegi – Yet Another Go Interpreter

#16
post #11
post #3

Programming in a language lacking a repl is always uncomfortable. I always wind up making a 'scratch.{ext}' file and running it to test things (scratch.* is in my global gitignore). Happy an interpreter+repl now exists for Go.

I think this is a matter of personal preference. At work my primary language is Python and I rarely use the REPL, and when I do, it's a regrettable experience--can't use up arrow to get previous command, can't use arrow keys to move cursor, entering tabs after the `. . .` makes it hard to figure out how many tabs to enter, etc. And of course you can't visualize the whole "program" at a glance like you can in a text e…

> when I do, it's a regrettable experience--can't use up arrow to get previous command, can't use arrow keys to move cursor

Dunno what's wrong with your readline but what you describe is default Python behavior. Try installing ipython, you'll get all that and more (such as syntax highlighting, multi-line editing, and much more).

Re: Yaegi – Yet Another Go Interpreter

#17
I'd be interested in an opinion of the dev on what was the hardest part to build. I could imagine reflection features or the incremental type checking would be hard to do. But I always see these projects (like cling/ROOT from cern) and think that some subproblems are really hard to do if done incrementally with only local knowledge.

Re: Yaegi – Yet Another Go Interpreter

#18
post #13
post #4

Earlier quoted context omitted.

You can do similar things by writing tests as you go, plus then you can keep the tests if they seem useful.

For one meaning of "test", sort of, but repls are useful for far more than "do outputs match what I expect". Test writing is not very good for exploratory programming.

Tests are perfect for "do outputs match what I expect". If you don't know what you are expecting yet just to `t.Error("")`. When you are done fiddling around and want to solidify what you expect add the `if foo != expectation`.

Re: Yaegi – Yet Another Go Interpreter

#19
post #11
post #3

Programming in a language lacking a repl is always uncomfortable. I always wind up making a 'scratch.{ext}' file and running it to test things (scratch.* is in my global gitignore). Happy an interpreter+repl now exists for Go.

I think this is a matter of personal preference. At work my primary language is Python and I rarely use the REPL, and when I do, it's a regrettable experience--can't use up arrow to get previous command, can't use arrow keys to move cursor, entering tabs after the `. . .` makes it hard to figure out how many tabs to enter, etc. And of course you can't visualize the whole "program" at a glance like you can in a text e…

I’ve often had similar feelings to you.

Something that blew my mind recently was using a Lisp repl which was integrated with my text editor.

I just wrote out the code I wanted to toy with in my text editor buffer, and then highlighted it and hit a key command to evaluate it at the repl without even needing to switch over to the repl window.

It would be so cool if we had great support for something similar in non Lisp languages.

Re: Yaegi – Yet Another Go Interpreter

#20
post #13

Earlier quoted context omitted.

For one meaning of "test", sort of, but repls are useful for far more than "do outputs match what I expect". Test writing is not very good for exploratory programming.

Tests are perfect for "do outputs match what I expect". If you don't know what you are expecting yet just to `t.Error("")`. When you are done fiddling around and want to solidify what you expect add the `if foo != expectation`.

To add to this, editor commands to quickly switch to your test file, auto generate test boilerplate and run the currently highlighted test are super helpful to speed up this loop.
Post reply on HN