Hacker Newsnew | past | comments | ask | show | jobs | submit | healeycodes's commentslogin

Editing the current line works because I brought in https://man7.org/linux/man-pages/man3/readline.3.html towards the end so I could support editing, tab completion, and history.

IIRC readline uses a `char *` internally since the length of a user-edited line is fairly bounded.


Very cool. Currently working on the beginning of a small text editor so this part seemed interesting and was curious of any overlap. Thanks for the interesting post!


worth noting that you get basic line editing for "free" from kernels tty subsystem even if you don't use readline.


Yes, but it is really basic. Is it more than backspace? Most cursor key presses are just forwarded to the program as escape sequences.


Author here, and yeah, I agree. I skipped writing a parser altogether and just split on whitespace and `|` so that I could get to the interesting bits.

For side-projects, I have to ask myself if I'm writing a parser, or if I'm building something else; e.g. for a toy programming language, it's way more fun to start with an AST and play around, and come back to the parser if you really fall in love with it.


Author here, one of the fastest improvements I've seen is @cloud11665's idea here: https://x.com/cloud11665/status/1955958965046595699


You can annotate the code blocks in the README to get generic lisp syntax highlighting.

```lisp

(+ 1 2)

```


Thanks.

It's unfortunately enough of a bad fit for me to prefer no highlighting; my own fault, the price you pay for adding syntax.


Yes, it works on any process that makes a SYS_getrandom call.


Ah, this is a useful distinction. Thanks.


The Lisp variant that the compiler supports at the moment only handles f64 numbers so I don't think this kind of issue is possible.

However, this is a very relevant point. If the goal is just shorter code (as opposed to a mix of shorter code and less run-time operations), then you need to check that folding strings (and similar types) actually makes the expression shorter to represent.


When a val is deployed on val town, my understanding is that it's parsed/compiled. At that point, can you save the parts of the program that people might search for? Names of imports, functions, variables, comments, etc.


A val is just Typescript, no? So unless they are also storing the AST it would be JavaScript and that's it


Awesome! I've been meaning to replace my usage of Python/JavaScript for tasks (which I believe) are more awk-shaped.


As long as you don’t care about unit test ability. Usually if you bothered to write them in Python or JS you usually don’t want to regress back to shell stuff. You’re already in a place where you have a runtime available so you can do way more stuff.

It’s usually the opposite direction that you mentioned that you want to go. You one liner some shell like awk to quickly get shit done without worrying about a runtime being available to you and then if you need it to be more robust and legible because of testing etc or production grade you move to a proper dynamic scripting environment


I'm really happy with the way val town responded to the security issues I raised! Big congrats to them for shipping this change – it sounds tricky on both the product and the tech side of things.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: