digitalmars.D.announce - powerline-d (I got an AI to port powerline-shell to D)
- FeepingCreature (62/62) Sep 04 2024 tl;dr: D port of powerline-shell, a beautiful command prompt with
- Sergey (16/19) Sep 04 2024 So awesome! thanks for sharing not only the code but also you
- jmh530 (3/8) Sep 04 2024 Your experience might make for a good blog post.
- Vladimir Marchevsky (4/7) Sep 04 2024 In case that really needs some arguing, I would say translation
- matheus (28/35) Sep 04 2024 The other day I was watching a video from programmer (Jason
- user1234 (5/12) Sep 04 2024 There are semantical differences between two languages. Things
- FeepingCreature (25/40) Sep 04 2024 Yeah, the nice thing about translation is that the things that
- aberba (8/15) Sep 23 2024 You would be surprised how much original code and code
- monkyyy (3/7) Sep 23 2024 https://www.youtube.com/watch?v=-ONQvxqLXqE
- Vladimir Marchevsky (16/22) Sep 24 2024 I've seen that. My point is: while AI sometimes **can** really
- FeepingCreature (20/46) Sep 25 2024 If somebody implemented intelligence as an algorithm, what form
- Vladimir Marchevsky (14/30) Sep 26 2024 "If"s are the matter of sci-fi. We are talking about usage of
- Vladimir Marchevsky (11/23) Sep 26 2024 I don't know whether images can be used here, so just a text
- monkyyy (13/16) Sep 27 2024 Approximation to the halting problem + code generation + value
- Imperatorn (3/7) Sep 23 2024 Nice, did you use ImportC also?
- FeepingCreature (6/14) Sep 26 2024 Yep! ImportC is responsible for the libgit2 bindings so I can
- Kagamin (3/9) Sep 30 2024 Obvious question. Can it riir?
- FeepingCreature (19/34) Oct 14 2024 Lol probably. I think the more visible typing and structure there
tl;dr: D port of powerline-shell, a beautiful command prompt with (among others) git status https://github.com/FeepingCreature/powerline-d Has this happened to you? You're using git, and you enter some command only to get a weird error about branches. About fifteen minutes later, you finally realize you were in the middle of a rebase. Wouldn't it be cool if your bash prompt automatically showed the status of the git repository in the current folder? Whether it's clean, whether you forgot to add any files, what branch you're on etc? Enter powerline-shell. It's a Python tool that is executed on every prompt render and adds a bunch of information, such as host, git status, and a whole bunch of other configurable widgets. I consider it plainly indispensable for commandline git use. Anyway, so a few days ago I noticed that powerline-shell was slow. Like, observable slowdown every time I hit return slow. It's kind of unavoidable, it's a Python project, it has to load the interpreter every time it starts. Now there's a few rewrites, one in Rust, one in Go, but I mean - we're a D shop, and I'll be damned if I make critical workflow dependent on a Rust tool. But hey, the source isn't *that* big - only 2116 lines spread over 43 files. 61KB of source code. That comfortably fits in the context window of Claude 3.5 Sonnet. So I thought - what's to it? Let's just throw it in there and see how it handles things. And what do you know, three hours and a long dialog later and seven bucks poorer, we have https://github.com/FeepingCreature/powerline-d . Anyone who says large language models aren't *really* intelligent now has to argue that programming doesn't require intelligence. At an estimate, this is 99.9% the AI's work, all I had to do was provide some design ideas and fix some syntax errors. And it definitely runs a lot faster than powerline-shell. How much faster? ``` $ time powerline-shell ... real 0m0,266s $ time powerline-d --shell bash ... real 0m0,072s ``` I'd say that's pretty meaningful. A lot of the speedup comes from me asking the AI to get rid of manual process calls to `ps` and `git` in favor of walking `/proc` or linking `libgit2` directly, but even before that it was about twice as fast, just from skipping the Python interpreter setup/teardown. I'm using it everywhere now instead of powerline-shell, and it works fine, which is to say indistinguishable from the original except the weird noticeable delay on hitting return is gone. I'd say it's a win. I do have to say this. I've tested the parts of this that I personally use, but there *were* some problems in there. However, widgets like `hg` support are totally untested, because I don't personally need them. It's in there, and it builds, but I have no clue what'll happen if someone tries to use it. Bug reports welcome!
Sep 04 2024
On Wednesday, 4 September 2024 at 12:24:07 UTC, FeepingCreature wrote:source code. That comfortably fits in the context window of Claude 3.5 Sonnet. So I thought - what's to it? Let's just throw it in there and see how it handles things.So awesome! thanks for sharing not only the code but also you experience. Recently I've asked on Discord who uses LLMs and and it turned out that most of the D community prefers to do development in the "old school" style.. | Model provider | Answers | |---|---| | Google | 1 | | OpenAI | 1 | | Anthropic | 1 | | MS/GitHub | 0 | | Local | 0 | | X/Twitter | 1 | | I'm not using LLMs | 8 |
Sep 04 2024
On Wednesday, 4 September 2024 at 12:24:07 UTC, FeepingCreature wrote:tl;dr: D port of powerline-shell, a beautiful command prompt with (among others) git status https://github.com/FeepingCreature/powerline-d [snip]Your experience might make for a good blog post.
Sep 04 2024
On Wednesday, 4 September 2024 at 12:24:07 UTC, FeepingCreature wrote:Anyone who says large language models aren't *really* intelligent now has to argue that programming doesn't require intelligence.In case that really needs some arguing, I would say translation is not a programming.
Sep 04 2024
On Wednesday, 4 September 2024 at 17:02:55 UTC, Vladimir Marchevsky wrote:On Wednesday, 4 September 2024 at 12:24:07 UTC, FeepingCreature wrote:The other day I was watching a video from programmer (Jason Turner from C++) writing a raycasting[1], but for what it seems he didn't know the math behind the intersection between line-segments, so he decided to ask chatgpt to come with an answer based on attributes/properties he had already written and the AI generated a version based on this. There was a problem with one sign in a expression and the raycasting was a mess, but on the other hand the programmer couldn't fix because he was just copying and pasting and de admittedly didn't know the math. He was only able to fix it when someone in chat pointed out the "sign problem". I think the state of all that was sad, I mean people will not use their brain anymore? - But on the other hand there is something going on since the AI was able to generate an algorithm based on specs given before hand in this specific language (Python), but I saw other videos with other languages too. What I mean by all this, we are at the beginning of this trend but I can't imagine the outcome, I don't know for example if the case of this topic is a good or bad thing yet, but I keep wondering about what the new programmers coming in the future will face. Finally I didn't want to derail the topic but the subject was already raised by the original poster, [1] - (https://yewtu.be/watch?v=0lSqedQau6w) you can change yewtu.be for the google one with ads if you wish. Matheus.Anyone who says large language models aren't *really* intelligent now has to argue that programming doesn't require intelligence.In case that really needs some arguing, I would say translation is not a programming.
Sep 04 2024
On Wednesday, 4 September 2024 at 17:02:55 UTC, Vladimir Marchevsky wrote:On Wednesday, 4 September 2024 at 12:24:07 UTC, FeepingCreature wrote:There are semantical differences between two languages. Things like implicit conversions, integral promotion, order of evaluation, etc. still need a good old human behing the screen.Anyone who says large language models aren't *really* intelligent now has to argue that programming doesn't require intelligence.In case that really needs some arguing, I would say translation is not a programming.
Sep 04 2024
On Wednesday, 4 September 2024 at 18:55:07 UTC, user1234 wrote:On Wednesday, 4 September 2024 at 17:02:55 UTC, Vladimir Marchevsky wrote:Yeah, the nice thing about translation is that the things that LLMs have the most trouble with, ie. high-level semantic design, class naming, abstraction, are already handled. But it's also not like the LLM isn't making its own choices. Recently, I got a LLM to *automatically* translate a program from asyncio-mqtt to paho-mqtt. That's not a syntax rewrite, it's a full-on migration, async to threads. It still handled it fine. The boundary at the top of abstraction work in programming where LLMs have trouble is really not all that big. The problem is that because current AIs are congenitally incapable of backspacing, high-level abstraction basically requires the AI to guess what it's gonna need from zero, and be right, because it can't change course. Defining an abstract class requires guessing what methods that class needs, because you can't backtrack. It isn't - can't be - good at that, and because of that, it isn't really trained in it either. But you can work around that with careful prompting and some iteration. For instance, you can see that we turned the Python segment classes into functions. That's a thing that I suggested, but my effort literally amounted to saying:In case that really needs some arguing, I would say translation is not a programming.There are semantical differences between two languages. Things like implicit conversions, integral promotion, order of evaluation, etc. still need a good old human behing the screen.Honestly the more I think about it, the more I feel the segments should really just be functions, since they don't interact.And later:Can you please refactor the segment logic so that the functions always return empty arrays for "don't include segments" and we never look at `content.empty`? Also remove unneeded parameters while we're at it.The LLM works a lot better when it's going "from file to file" making small to moderate incremental changes. (Like us, really.)
Sep 04 2024
On Wednesday, 4 September 2024 at 17:02:55 UTC, Vladimir Marchevsky wrote:On Wednesday, 4 September 2024 at 12:24:07 UTC, FeepingCreature wrote:You would be surprised how much original code and code modifications LLMs can output. I wouldn't be to quick to dismiss them as mere translation tools. For example, take a look at the intro video on the Zed homepage to see what can be achieved with AI assisted coding (https://zed.dev/)Anyone who says large language models aren't *really* intelligent now has to argue that programming doesn't require intelligence.In case that really needs some arguing, I would say translation is not a programming.
Sep 23 2024
On Monday, 23 September 2024 at 08:46:30 UTC, aberba wrote:For example, take a look at the intro video on the Zed homepage to see what can be achieved with AI assisted coding (https://zed.dev/)https://www.youtube.com/watch?v=-ONQvxqLXqE Run real tests, most ai examples are faked
Sep 23 2024
On Monday, 23 September 2024 at 08:46:30 UTC, aberba wrote:You would be surprised how much original code and code modifications LLMs can output. I wouldn't be to quick to dismiss them as mere translation tools. For example, take a look at the intro video on the Zed homepage to see what can be achieved with AI assisted coding (https://zed.dev/)I've seen that. My point is: while AI sometimes **can** really look great doing something, people should always keep in mind it's just a complex math intended to generate specific patterns. It's not intelligent, it doesn't really understand any context, neither it understands anything it outputs. Image generation is a great example: there are lot of nice images done by AI but there are also tons of garbage produced - with wrong limbs, distorted faces, etc, etc. General-use ChatGPT answers with lots of text meaning barely anything or swapping topics is another great example. And while you sometimes can be fine with some small mistakes in image, coding has no room for that. So, my personal opinion: AI can be great in generating some repetitive or well-defined code to do some typing instead of human, but it still needs a good programmer to ensure all results are correct.
Sep 24 2024
On Tuesday, 24 September 2024 at 07:23:26 UTC, Vladimir Marchevsky wrote:On Monday, 23 September 2024 at 08:46:30 UTC, aberba wrote:If somebody implemented intelligence as an algorithm, what form would you expect it to take *other* than "complex math generating specific patterns"?You would be surprised how much original code and code modifications LLMs can output. I wouldn't be to quick to dismiss them as mere translation tools. For example, take a look at the intro video on the Zed homepage to see what can be achieved with AI assisted coding (https://zed.dev/)I've seen that. My point is: while AI sometimes **can** really look great doing something, people should always keep in mind it's just a complex math intended to generate specific patterns. It's not intelligentit doesn't really understand any context, neither it understands anything it outputs.You can disprove this to yourself by just talking to it. Have a chat, have it explain what it was going for. Doesn't always work reliably, but that there's *no* understanding there is easily disproven.Image generation is a great example: there are lot of nice images done by AI but there are also tons of garbage produced - with wrong limbs, distorted faces, etc, etc.It should be noted that the text models used by image generators are, by current-year standards, absolutely tiny. Like, GPT-2 tier. It does not surprise me that they don't understand things, nor does it say anything about the chat models, which can be a hundred times or more bigger.General-use ChatGPT answers with lots of text meaning barely anything or swapping topics is another great example. And while you sometimes can be fine with some small mistakes in image, coding has no room for that.As usual - make sure you're using GPT-4 not 3.5! The question isn't "does it make mistakes", the question is "does it make more mistakes than I do." And in my experience, Sonnet makes *less.* His code compiles a lot more reliably than mine does!So, my personal opinion: AI can be great in generating some repetitive or well-defined code to do some typing instead of human, but it still needs a good programmer to ensure all results are correct.Well, that's the case anyways.
Sep 25 2024
On Thursday, 26 September 2024 at 06:58:28 UTC, FeepingCreature wrote:If somebody implemented intelligence as an algorithm, what form would you expect it to take other than "complex math generating specific patterns"?"If"s are the matter of sci-fi. We are talking about usage of existing software.You can disprove this to yourself by just talking to it. Have a chat, have it explain what it was going for. Doesn't always work reliably, but that there's *no* understanding there is easily disproven."Doesn't work reliably" is an actual proof of it having no understanding. It's patterns just sometimes match common logic (or you imagine the reasons behind it). If some kid sometimes called a specific animal a cat and other times called the same animal a dog, you'll be sure that kid has no idea what cats and dogs actually are.It should be noted that the text models used by image generators are, by current-year standards, absolutely tiny. Like, GPT-2 tier. It does not surprise me that they don't understand things, nor does it say anything about the chat models, which can be a hundred times or more bigger.Extremely advanced waxwork is still a waxwork, even when it looks like a real food or person. It doesn't matter how many patterns you put into model, it still just randomly mimics those patterns.The question isn't "does it make mistakes", the question is "does it make more mistakes than I do." And in my experience, Sonnet makes *less.* His code compiles a lot more reliably than mine does!I'll keep that without response, I think...
Sep 26 2024
On Thursday, 26 September 2024 at 06:58:28 UTC, FeepingCreature wrote:You can disprove this to yourself by just talking to it. Have a chat, have it explain what it was going for. Doesn't always work reliably, but that there's *no* understanding there is easily disproven.I don't know whether images can be used here, so just a text quote of ChatGPT 4o:- Human brain weights about 1400 grams. Hamster brain weights about 1.4 grams. How many hamsters are needed to create one human brain? - To determine how many hamsters' brains would equal the weight of one human brain, you can divide the weight of a human brain by the weight of a hamster brain: [weight calculations here]. So, it would take 1,000 hamsters' brains to match the weight of one human brain.It's completely obvious how there is no understanding of context at all. It just matches a simple weight calculation pattern and completely ignores a clear context of an actual question that asks something else. You can imagine the effect of such "off-topic" somewhere deep in the complex generated code. I wouldn't trust this to write any code that is not triple-checked by real programmers afterwards...
Sep 26 2024
On Thursday, 26 September 2024 at 06:58:28 UTC, FeepingCreature wrote:If somebody implemented intelligence as an algorithm, what form would you expect it to take *other* than "complex math generating specific patterns"?Approximation to the halting problem + code generation + value heavy assessment of data An nn is a const time machine, any outside influence is not holistically communicating how it should be spending its time or changing previsous output. If you ask "is 2+2=4" and the first piece of output is 'n' by roll of the dice, it has already decided to say "no" it will vomit out 5 paragraphs defending it. A general intelligence will at least be able to do everything a human can, and humans have backspace, humans can notes when they want to, humans can spend a full life time on one problem or declare something impossible in a second.
Sep 27 2024
On Wednesday, 4 September 2024 at 12:24:07 UTC, FeepingCreature wrote:tl;dr: D port of powerline-shell, a beautiful command prompt with (among others) git status https://github.com/FeepingCreature/powerline-d [...]Nice, did you use ImportC also?
Sep 23 2024
On Tuesday, 24 September 2024 at 05:30:32 UTC, Imperatorn wrote:On Wednesday, 4 September 2024 at 12:24:07 UTC, FeepingCreature wrote:Yep! ImportC is responsible for the libgit2 bindings so I can avoid calling the git client manually every time I want some info about the current directory. After I got the concept, it was smooth sailing; The DMD version differences are a bit awkward, but that's normal for a fairly new feature.tl;dr: D port of powerline-shell, a beautiful command prompt with (among others) git status https://github.com/FeepingCreature/powerline-d [...]Nice, did you use ImportC also?
Sep 26 2024
On Wednesday, 4 September 2024 at 12:24:07 UTC, FeepingCreature wrote:Now there's a few rewrites, one in Rust, one in Go, but I mean - we're a D shop, and I'll be damned if I make critical workflow dependent on a Rust tool. But hey, the source isn't *that* big - only 2116 lines spread over 43 files. 61KB of source code. That comfortably fits in the context window of Claude 3.5 Sonnet.Obvious question. Can it riir?
Sep 30 2024
On Tuesday, 1 October 2024 at 05:59:30 UTC, Kagamin wrote:On Wednesday, 4 September 2024 at 12:24:07 UTC, FeepingCreature wrote:Lol probably. I think the more visible typing and structure there is, the more it struggles. It has problems with D imports too. Humans can go back and add something to the top of the line - a LLM has to keep typing, front to bottom. Honestly to be optimal for LLMs, function parameters should be at the bottom.Now there's a few rewrites, one in Rust, one in Go, but I mean - we're a D shop, and I'll be damned if I make critical workflow dependent on a Rust tool. But hey, the source isn't *that* big - only 2116 lines spread over 43 files. 61KB of source code. That comfortably fits in the context window of Claude 3.5 Sonnet.Obvious question. Can it riir?"Doesn't work reliably" is an actual proof of it having no understanding. It's patterns just sometimes match common logic (or you imagine the reasons behind it).Honestly, this applies exactly to humans. We are just better at noticing when our patterns break and correcting ourselves. Since I've started using LLMs, I've frequently noticed myself saying blatantly wrong things and going "heh, stochastic parrot moment". It's very clear to me that my language generation is just a next-token predictor with a bunch of sanity checks. Sometimes those checks take a bit too long to kick in and I misspeak. They'll get there.If some kid sometimes called a specific animal a cat and other times called the same animal a dog, you'll be sure that kid has no idea what cats and dogs actually are.No? You'd say it's confused about cats and dogs. It has *some* model, or else it would call them a toaster or a water with equal frequency.
Oct 14 2024