1. lack of native GC, you had to roll your own by providing a runtime.
2. lack of tail-call elimination in V1 of the spec. This essentially forces you to trampoline everything.
443 karma · joined October 13, 2013
1. lack of native GC, you had to roll your own by providing a runtime.
2. lack of tail-call elimination in V1 of the spec. This essentially forces you to trampoline everything.
Another cool online thing that exists is CP, a language with disjoint intersection and union types:
If I was them I’d be using OCaml to build up functional “kernels” which could be run in a way that requires zero allocation. Then you dispatch requests to these kernels and let the fast modern generational GC clean up the minor cost of dispatching: most of the work happens in the zero-allocation kernels.
That being said, having all drones equipped with cameras could enable a more robust version of what they’re talking about:
If uplink with human operators is lost, but short-range comms between drones exist, they could use their video feeds to autonomously coordinate amongst themselves.
We have two years of footage from Ukraine, where camera-equipped drones are launched from a several miles away at most, and where there are networks of pilots and support specialists to assemble and launch more drones in case of (frequent) failure.
I don’t think it’s wise to wager the success of a 6-month mission deep in enemy territory on a plan with a single point of failure, especially when the alternative is equipping each drone with < $100 cameras.
But sure, you’re clearly the better thinker.
…but if GPS is jammed, and there’s only one camera per fleet, how exactly are the other drones supposed to navigate towards the spotted targets unless they’re all equipped with cameras?
I think you can still have the functionality described in the article: you would send “hole” markers tagged with their level. Then, you could make additional requests when you encounter these markers during the recovery phase, possibly with buffering of holes. It becomes a sort of hybrid DFS/BFS approach where you send as much tree structure at a time as you want.
However, the more I’ve learned about category theory, the more I’ve understood it as a way of defining what things are and what properties follow from those definitions.
Like, a monad really doesn’t have meaning beyond “monoid in the category of endofunctors”. The same is true for monoids and endofunctors: it’s all about the properties of those objects.
In the context of programming, we can impose all kinds of meaning, but the definitions and laws are really what makes it all work when you piece it together.
I guess my approach is to suffer through it until some understanding is gleaned, which admittedly isn’t very satisfying or easy haha.
If the teams working on the two are different, or even if the expertise level is uneven, something like a typed serialization library is a great boon.
At work, I maintain a Haskell-like programming language which spits out JSON representations of charts over OLAP queries. I’m the only one who knows the language extensively, but everyone is expected to do work with the JSON I push. If I serialize something incorrectly, or if someone else mistypes the frontend JSON response definition, we’re in for a world of pain.
Needless to say, I’ll be adding something like Zod to make that situation safer for everyone.
If your job is to render arbitrary user HTML, this could get much more hairy. First of all, print rendering at the time(and probably now) was notoriously finicky. Things like adjusting colors, improper rendering of SVGs, pagination were difficult. It took a lot of effort to get right.
Furthermore, if you're sending arbitrary HTML, you now have a much larger security exploit surface. If someone figures out how to call `addEventListener` within the page context, they can snoop on every PDF generated by that page.
I remember the afternoon I had the idea: it was beer Friday -and it took a few hours to write up a basic prototype that rendered a PDF in a few hundred milliseconds. That was the first time I’d written a 100x speed improvement. Felt like a real rush.
At a previous company we moved off of wkhtmltopdf to a nodejs service which received static html and rendered it to pdf using phantomjs. These days you probably use puppeteer.
The trick was keeping the page context open to avoid chrome startup costs and recreating `page`. The node service would initialize a page object once with a script inside which would communicate with the server via a named Linux pipe. Then, for each request:
1. node service sends the static html to the page over the pipe
2. the page script receives the html from the pipe, inserts it into the DOM, and sends an “ack” back over the pipe
3. the node service receives the “ack” and calls the pdf rendering method on the page.
I don’t remember why we chose the pipe method: I’m sure there’s a better way to pass data to headless contexts these days.
The whole thing was super fast(~20ms) compared to WK, which took at least 30 seconds for us, and would more often than not just time out.
Like… I get it: your design language revolves around treating UI elements as physical objects. Messing with text is a step too far. Text is not a bunch of boxes connected by springs.
My definition is pretty vague, usually requiring a bit of trashiness in the finished product.
I think the discussion here would be different if the tone was more moderated. Seems like you’re dying on a hill for the right to be abrasive without consequence.
Not clicking on a documentation link on a technical project is the definition of a shallow dismissal in my opinion.
In rust it is a logic error, which leads to data corruption or program panics within your application. In C it leads to data corruption and is an attack vector for the entire machine.
And yes, while Rust itself doesn’t help you with this type of error, there are plenty of Rust libraries which do.
Still, being free from GC is important in some domains. Beyond being able to attach types to scopes via lifetimes, it also provides runtime array bounds checks, reference-counting shared pointers, tagged unions, etc. These are the techniques used by managed languages to achieve memory-safety and correctness!
For me, Rust occupies an in-between space. It gives you more memory-safe tools to describe your problem domain than C. But it is less colloquially "safe" than managed languages because ownership is hard.
Your larger point with indices is true: using them throws away some benefits of lifetimes. The issue is granularity. The allocation assigned to the collection as a whole is governed by rust ownership. The structures you choose to put inside that allocation are not. In your user ID example, the programmer of that system should have used a generational arena such as:
https://github.com/fitzgen/generational-arena
It solves exactly this problem. When you `free` any index, it bumps a counter which is paired with the next allocated index/slot pair. If you want to avoid having to "free" it manually, you'll have to devise a system using `Drop` and a combination of command queues, reference-counted cells, locks, whatever makes sense. Without a GC you need to address the issue of allocating/freeing slots for objects within in an allocation in some way.
Much of the Rust ecosystem is libraries written by people who work hard to think through just these types of problems. They ask: "ok, we've solved memory-safety, now how can we help make code dealing with this other thing more ergonomic and correct by default?".
- no buffer overflows - no use after free - no data races
These problems lead to security vulnerabilities whose scope extends beyond your application. Buffer overflows have historically been the primary mechanism for taking over entire machines. If you emulate pointers with Rust indices and don’t use “unsafe”, those types of attacks are impossible.
What you’re referring to here is correctness. Safe Rust still allows you to write programs which can be placed in an invalid state, and that may have security implications for your application.
It would be great if the compiler could guarantee that invalid states are unreachable. But those types of guarantees exist on a continuum and no language can do all the work for you.
If a system is providing incorrect medical diagnoses, or denying services to protected classes due to biases in the training in the training data, someone should be held accountable.
I would think as long as the manufacturer and the operator are not the same entity then the danger in that regard would be mitigated.