3 ms·
An interesting writeup, but <troll>like most oversimplified functional programming writeups</troll> they are ignoring a lot of external state around Factorio "f
by falcolas 6y ago
An interesting writeup, but <troll>like most oversimplified functional programming writeups</troll> they are ignoring a lot of external state around Factorio "functions" and "composed functions" - things that absolutely need to be considered when creating a factory.
For example: energy requirements, inserter speed (and the impact of that and inserter stack size on throughput), input/output bottlenecks, pollution, efficiency modules (which really mucks with the "an assembler is a function" analogy), beacons, and probably more.
- Ericson2314 6y agoNone of those resemble imperative programming though. Imperative programming would be like instead of having your factorio factory, having 1-32 employees running around at ludicrously fast speeds doing all the work trying not to crash into each other.
- Ericson2314 6y agoAnd microservices is more like normal Factorio, but spending a bunch of time designing all the building blocks a few redundant ways, and then getting really drunk and blindfolded before placing them on the map. And then having your equally drunk and blindfolded factory reliability engineers fight off the swarming bugs.
- falcolas 6y agoWhich is, funnily enough, roughly how it's programmed. Each entity has a state, time is advanced, and the threads run through their queue of entities and update their state, along with the state of connected entities. Since some entities interact directly with other entities (such as two fluid pipe segments), these queues are ordered (so the fluid movement and pressure calculations make sense). For example, a belt would advance the items on it 1/60th of its speed. Inserters would look to see if there's room in the destination, if there are items within their reach on the belt, and start moving to pick them up. Assemblers would check to see if they're currently building something, if they're full (the quantity that determines "full" is based on whether there's an outgoing inserter attached), if they have the necessary ingredients in their incoming buffer, and start incrementing the creation timer. The outgoing inserter would check for items in the assembler's output, grab them, and so forth.
- Ericson2314 6y agoSee, Factorio should be implemented by reflashing an FPGA every time one places a new structure :D
- elihu 6y agoThat's basically what you get in Factorio with logistics bots. They fly around grabbing things out of boxes and putting them in other boxes, according to what's being "requested" and "provided" on their logistics network. (They don't crash into each other. That would be an amusing mod.)
- Ericson2314 6y agoI do think that Amazon being more interested in delivery drones than society is interested in the revival of large scale pneumatic tube networks says something deep about us.
- TameAntelope 6y agoYeah, that was the obvious missing piece when I took a look at the article, a lack of rate calculations. Basically the whole game is driven on rate and ratios, not just ratios.
- munk-a 6y agoAs a counter argument in my day-job I generally assume that the DB will have available disk space and I don't have to worry too much about memory usage unless it becomes an issue (I do avoid naively globbing as much memory as possible but I also avoid premature optimization). Both of those constraints do exist on programming but they don't come up often enough that generally we'll discuss or review code entirely ignoring those effects and instead favoring correctness. Most of the items you listed aren't really important when discussing the nature of a function in the same way the fact that I happened to write my 1+1=2 algorithm on a RISC architecture isn't fundamental for teaching - sure it will potentially behave differently on a different processor - sometimes an intel bug might even cause subtle float errors - but those are implementation details and this article is focused on theory.
- konjin 6y agoIt is in factorio though. Factorio, as normally played, is much closer to analog electrical circuits than it is to digital computers. In flows of resources and outflows of products that change dynamically and in real time.
- lowbloodsugar 6y ago<troll>Yeah, but it's a really good analogy. Here is this "nice" system that makes you feel warm and fuzzy, and underneath is implemented using imperative programming, whose purpose is to waste a huge amount of your spare time, for fun. Sounds exactly like functional languages to me!</troll>