Rust gotcha I haven't seen before: you can't move out of a vec by index, even if you own the vec.
This is because it'd leave the vec in a bad state: you need .remove() or .pop() instead.
miniblog.
I was looking for some basic examples of Scala syntax, and it looks like they've changed quite a bit in the 2 -> 3 transition!
It's the biggest syntax change I think I've seen in an established language.
Getting basic language infrastructure going is surprisingly labour intensive.
I've built a toy language up to hello world -- lexing, parsing, evaluating and minimal REPL. I'm already at over 100 commits and 900LOC of Rust (source: https://github.com/Wilfred/garden/tree/6b0ecf775b45047d927f00e0469e178b72c929f2).
Crikey, users are asking ChatGPT about C++ undefined behaviour! Https://news.ycombinator.com/item?id=34706438
pop_back on an empty vector is UB apparently.
Which programming languages are the closest to 'finished'? In other words, which are unlikely to expand core features or syntax such that best practices change.
C and Scheme seem to fit this, are there other languages?
I find zoxide invaluable for jumping between frequently used directories: https://github.com/ajeetdsouza/zoxide
TIL that you can also use it like cd!
$ z /foo/bar
$ z ..
Short and very accessible introduction to implementing unification, including Python sample code: https://eli.thegreenplace.net/2018/unification/
Python's GIL is well known, but many languages have limitations on multithreading (e.g. JS, Ocaml).
Perhaps this is a consequence of C as a popular implementation language? A GIL could be less common when Rust is the implementation language.
Wonderful article comparing error wording and display across many different programming languages: https://www.amazingcto.com/developer-productivity-compiler-errors/
I've released difftastic 0.43! In this release:
* Support for R
* Better behaviour on Windows
* A bunch of display bugfixes
https://github.com/Wilfred/difftastic/releases/tag/0.43.0
I'm dusting off a Rust project from 2016, and it's striking how much the ecosystem has grown. For example, I used getopts then whereas clap is delightful and does so much now.
I really like languages that store their runtime stack on the heap, such as Smalltalk.
You can write code as if you have tail call optimisation, but you still have normal stack traces for debugging.
Codeforces is a huge website with a wealth of well-defined programming problems: https://codeforces.com/help#q1
(Useful for program synthesis and other situations where you want a large problem set to play with.)
I don't have a favourite 'just an integer' type in Rust. I was writing a progress function for a Rust program that counts up to 20 input files.
u64 is sometimes fiddly, usize makes me think about indexing, and u32/u16/u8 make me think that something is performance sensitive.
Are there any languages that display stack traces really well? Do you have a favourite?
The trend for package managers seems to be increasingly installing packages locally, in the directory of the current project.
C: exclusively system packages
Python: system or 'virtual' (local) packages
JS, Rust: exclusively local packages
zsh is generally wonderful, and it's sufficiently like bash/POSIX sh that it works.
However, it uses 1-indexed arrays, whereas bash uses 0-indexed arrays. This totally caught me out.
It's a tragedy that ; and : are often on the same key on the keyboard, are often both legal syntax, and are so visually similar. I wonder how much programmer time has been wasted.
I'm adding R support for difftastic, and it seems to work pretty well!
> Converting to hexl format discards undo info; ok? (y or n)
I really admire how seriously Emacs looks after your undo state. Not enough software will warn you if you're about to discard undo information.
Showing 181-200 of 235 posts