5 ms·
Language and shell in Go with 92% test coverage and instant CI/CD [video]
- xiaq 2y agoHey, it's my talk, AMA :) If you're interested in Elvish, you may also be interested in the talk on its design - https://www.youtube.com/watch?v=wrl9foNXdgM https://www.youtube.com/watch?v=wrl9foNXdgM
- HeralFacker 2y agoDo you have a link to a copy of the video with captions? YouTube autogen doesn't cut it unfortunately. Or perhaps a written-form version (slide deck + transcript)? What's in the 8% not covered by testing?
- xiaq 2y agoI don't have a version with captions, sorry. You can find the slidedeck at https://github.com/elves/elvish/blob/master/website/slides/2024-08-gophercon-uk.md https://github.com/elves/elvish/blob/master/website/slides/2... The remaining 8% mostly falls into the following categories: - Code that use OS functionalities that are cumbersome to mock in tests - Code paths that are triggered relatively rarely and I was simply too lazy to add tests for them Nothing is impossible to cover, but for whatever reason it was too much work for me when I wrote the code. However, it's worth mentioning that I only settled on the transcript test pattern fairly recently, and if I were to rewrite or refactor some of the untested code today I would add tests for them, because the cost of adding tests has been lowered considerably. So Elvish's test coverage is still increasing slowly as the cost of testing decreases.
- deleted 2y ago[deleted]
- zvolsky 2y agoHey, thanks again for the talk and for answering my fork bomb question with a live demo!
- xiaq 2y agoThanks for your question and glad that you enjoyed it!
- hnlmorg 2y agoI thought you handled the question really well. To be honest the whole talk was excellent. I'm gutted I missed it in person.
- xiaq 2y agoThanks! Murex talk when??? :)
- hnlmorg 2y agohaha I can't present nearly as well as yourself but maybe one day. It's not easy to present though. I know on HN we see a lot of very clever people give some well executed presentations and it's sometimes easy to forget how much preparation and courage it takes to perform like that. And it's great to see how engaged people were with the content too. Sorry, this is less of a question and more just comment of appreciation.
- xiaq 2y agoThanks, I appreciate the comment the appreciation :)
- heleninboodler 2y agoThere were a lot of aspects of this talk that I thought were really great. The willingness to try something unscripted, diving into the code repo live (e.g. to show where fuzzing is used), and the discussions of the reasoning behind the design choices. Great job @xiaq. This really makes me want to try elvish out, and I usually am quite skeptical of new shells.
- deleted 2y ago[deleted]
- 0xdeadbeefbabe 2y agoIn vim vi or nvim :r !date gives me shell returned 2
- xiaq 2y agoDid you set your login shell to Elvish? Vim unfortunately relies on your shell being a POSIX shell, but you can fix that with "set shell=/bin/sh" in your rc file.
- xiaq 2y agoFWIW, I've just added this instruction to https://elv.sh/get/default-shell.html#vim-/-neovim https://elv.sh/get/default-shell.html#vim-/-neovim
- mpenick 2y agoDoes elvish have a command history limit? Or is it configurable? I like a nearly infinite history.
- risenshinetech 2y ago[flagged]
- 38 2y agohow is this an on topic comment?
- randomdata 2y agoLooks more like a question than a comment.
- AnimalMuppet 2y agoLooked like a "just asking questions" question. Like it had a point to make and an axe to grind.
- cdcarter 2y agoDo you have any written posts or documents about this language and your design decisions?
- whereistimbo 2y agohttps://elv.sh/ https://elv.sh/
- xiaq 2y agoI gave a talk about the design: https://www.youtube.com/watch?v=wrl9foNXdgM https://www.youtube.com/watch?v=wrl9foNXdgM As the sibling comment mentioned, you can find documentation on Elvish itself on the website https://elv.sh https://elv.sh. There are tutorials and (not 100% but fairly complete) reference documents.
- throwaway2016a 2y agoThis seems like a cool project. This is meant as additional information not criticism. I skimmed the transcript really fast so if this is in there and I missed it, please correct me, but two things I think are helpful for people creating projects like this to be aware of: - This video seems to combine the concepts of lexing and parsing. It is usually beneficial to separate these two steps and lex the input into tokens before passing to the parser. - Go actually has a pure Go implementation of Yacc in the toolset and I've used it in several projects to make parses. Dealing with the Yacc file is often much easier than dealing with code directly since it takes care of writing the actual parser. There is a lot of boiler plate that goes into parsers that when you use Yacc it "just works". Edit: there are also some tools for writing parsers in Lex/Flex like syntax (re2c comes to mind) but I've found hand writing lexers to be effective in Go if your language doesn't have many different types of tokens.
- ridiculous_fish 2y agoShells have somewhat unusual parsing requirements. For example "if" is a keyword when used as `if echo` but not `echo if`. So you either need to implement the lexer hack, or have a "string" token type which is disambiguated by the parser (which is what fish-shell does). https://en.wikipedia.org/wiki/Lexer_hack https://en.wikipedia.org/wiki/Lexer_hack
- radiospiel 2y agounless i miss something this should not be an issue. the lexer could parse if as an IF token, and the parser could treat tags as STRING || IF ( || other keywords… )
- duskwuff 2y agoThat seems like it'd get really awkward pretty quickly. "if" isn't unique in this regard; there are about a hundred shell builtins, and all of them can be used as an argument to a command. (For example, "echo then complete command while true history" is a valid shell command consisting entirely of names of builtins, and the only keyword in it is the leading "echo".)
- solidsnack9000 2y agoThe availability of `else` in `while`, `for`, and `try` is an interesting feature of Elvish. https://elv.sh/ref/language.html#while https://elv.sh/ref/language.html#while
- hackernudes 2y agoPython has it too, but they don't work the same way (the python 'else' always runs unless the while loop is exited with 'break'). https://docs.python.org/3/reference/compound_stmts.html#while https://docs.python.org/3/reference/compound_stmts.html#whil...