3 ms·
If you skimmed the article and missed the subtle notes, the author deliberately chose the wrong way to use the Rust version to make a point. Even ChatGPT told h
by Aurornis 1y ago
If you skimmed the article and missed the subtle notes, the author deliberately chose the wrong way to use the Rust version to make a point. Even ChatGPT told him it was wrong for his use case:
> As mentioned, the other way to use the Rust version has the same behaviour as the Haskell/Lean/etc versions. ChatGPT did actually point out to me that this way was better, and the other way (the one I used) was adequate only if the input was limited to ASCII.
- dfee 1y agoYes, there was vibe coding throughout. Should've probably been an article about how vibe coding results in incorrect software.
- Aurornis 1y agoIt’s more than that. ChatGPT actually gave the right answer but they chose not to use it to make a point.
- tracker1 1y agoNot quite right... as there would still be 3 failures in the tests, like Haskel. Realistically, I would expect to have a couple different methods available... one that split a string into groups of code segments that represent a single unit, and a display width of units (0-2). Alternatively another method that just counted the display width in numbers of character spaces (assuming mono-spacing). Then you could apply the padding more naturally. The grouping of characters would be more for other tests for display beyond left padding.
- IshKebab 1y agoThey were definitely trying to make Rust look worse than it is. They even sarcastically acknowledge that: > I didn’t deliberately pick the one which made Rust look even worse than all the others, out of peevish resentment for every time someone has rewritten some Python code (my go-to language) in Rust and made it a million times faster – that’s a ridiculous suggestion. And > Rust, as expected, gets nul points. What can I say?
- tracker1 1y agoFound it... Counting display width[1], getting unicode segments[2]. 1. https://crates.io/crates/unicode-display-width 2. https://crates.io/crates/unicode-segmentation
- whbrown 1y agoTo be fair, you'd have to also import this crate to get the result he wanted: https://docs.rs/unicode-segmentation/latest/unicode_segmentation/ https://docs.rs/unicode-segmentation/latest/unicode_segmenta...