Benchmarking the cost of array bounds checks in Rust code: https://blog.readyset.io/bounds-checks/
The author even patches rustc to make sure *all* bounds checks are gone, in order to compare the performance!
miniblog.
I really like "zero cost abstractions" as a programming language motto. It's really effective for evaluating design decisions.
I've heard it for both C++ and Rust. Are there other PL mottos that are equally helpful?
TIOBE considered misleading: https://blog.nindalf.com/posts/stop-citing-tiobe/
It claims that iOS + macOS is less than half the size of Visual Basic!
TIL you can express pretty much all typescript type syntax in JSDoc comments: https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html
This gives you all the IDE benefits of typescript, but you don't need a compile step to run your code.
Today I learnt that null bytes are valid in UTF-8 and ASCII strings!
It was a surprise -- \0 doesn't feel like text -- but it'd be even more awkward when using C-style strings.
RFC 9116 was published this year, which promotes having /.well-known/security.txt as a standard file woth contact information for security issues.
It also notes that having this file does not mean you're running a CTF exercise :)
https://www.rfc-editor.org/rfc/rfc9116
Self hosting is really nifty, but it's an additional cognitive burden.
For example, I can run difftastic on its own history. I use plain git-diff just as often.
My best improvements have come from using it in other codebases. It lets me think about one thing at a time
OCaml has several unusual design features that I've come to appreciate.
(1) Separating integer and float addition is really clear.
(2) No subtyping (everything is 'a or concrete) simplifies lots too.
Good code using regexes often has a comment giving an example of a typical string that it matches.
Could this be a first class language feature? It's a great pattern.
Another nice feature of OO in Common Lisp: you initialise your class instance with the function initialize-instance.
So many languages define a 'construct' as a method that has access to the current instance, which is really kinda confusing (c.f. __init__ and __new__ in Python).
Common Lisp has a function change-class that lets you change the class of instance (like reassigning __class__ in Python). http://clhs.lisp.se/Body/f_chg_cl.htm
I love the note at the end: "semantic difficulties" if you call any methods whilst the class changes!
Uniform function call syntax (UFCS) is nifty: I can write foo(x, y, z) or http://x.foo(y, z).
Dot syntax for calls works incredibly well for IDE completion. Are there any languages that explicitly offer UFCS so the IDE experience is better?
Smalltalk has a remarkable method named #become: that allows you to modify all pointers to a given object to point to a different object!
https://gbracha.blogspot.com/2009/07/miracle-of-become.html
This goes even further than updating instances when a class changes, it's changing instance references.
Suppose you have an awesome idea for a programming language.
What use case do you focus on for V1? Web apps? Games? Something else?
How would you choose your niche?
I feel like Rust often pushes me to use concrete types.
It's a lot easier to return a Vec than an impl Iterator. It's not a big problem, but in e.g. Java I'd just say I'm returning some kind of iterator.
> We searched 3154 Twitter accounts and found 519 accounts with 527 Fediverse IDs, spread over 136 instances.
https://debirdify.pruvisto.org/ seems to find more users, and it also shows some interesting stats on relevant / popular instances.
Rust macro errors are significantly improving:
https://github.com/rust-lang/rust/pull/103439
I've never seen a language add a full-featured REPL later in its life. It's incredibly hard to add "update function definition" interactively.
Clojure is an interesting case. It was developed with a REPL in mind, but the JVM was not. Perhaps the VM matters less here?
https://twitodon.com/ is a neat tool for finding Mastodon people that you were already following on Twitter. It generates a CSV that Mastodon can consume.
Of the 3,154 folks I follow, it found 117 Mastodon accounts. AIUI it requires other users to use the service.
I feel like enums/variants/tagged unions are underexplored in dynamically typed languages.
As soon as you see a pattern match for a given enum variant (e.g. colour::RED), your can IDE can be helpful if the enum definition changes. Normally I only get this with static typing.
Showing 521-540 of 7,506 posts