News for hackers. Stuff that matters.
Re:Out of the Tar Pit (2006) [pdf] by enlyth on Tuesday February 28, 2023 @12:59PM (#34972536)
> There is no essential mutable state in computer science.

Yes, theoretically. Now imagine your mutable state is 2GB in size, have fun creating a copy of it on every change.

Re:Out of the Tar Pit (2006) [pdf] by kccqzy on Tuesday February 28, 2023 @01:41PM (#34973097)
You are not getting the point of my comment or the original article. It's clear to me that the kind of complexity being talked about in the article is cognitive complexity not computational complexity. It's not about choosing between an O(n) copying of data and O(1) in-place mutation; it's about choosing code that's easy to comprehend and maintain.
Re:Out of the Tar Pit (2006) [pdf] by deathanatos on Tuesday February 28, 2023 @02:49PM (#34973902)
Their point is that you can't choose the cognitively simpler choice because of real world design constraints, such as not consuming all available RAM β€” i.e., because of essential complexity.
Re:Out of the Tar Pit (2006) [pdf] by kragen on Thursday March 02, 2023 @12:42PM (#34999022)
that's complexity introduced by your approach to the solution (using an inadequately large computer) rather than essential to the problem you're trying to solve
Re:Out of the Tar Pit (2006) [pdf] by akkartik on Thursday March 02, 2023 @01:43PM (#34999912)
I think the crux is which side gets to be called "essential". Is it the abstract problem the code is intended for, or is it the real world we're living in. Mike Acton argues for the latter (https://www.youtube.com/watch?v=rX0ItVEVjHc)

And all this is heat rather than light because there is absolutely a significant fraction of concerns that both sides would agree are utterly incidental/accidental complexity.

Re:Out of the Tar Pit (2006) [pdf] by kragen on Thursday March 02, 2023 @02:08PM (#35000266)
i think that's a purely semantic or terminological debate, so it isn't important which part we declare 'essential' and which part we declare 'accidental', and arguments that one definition or the other is better are pointless

what is important is that we understand which definitions people were using in particular utterances, that our definitions have adequate ontological coherence (avoiding "eargrayish" reasoning errors), and that other people can understand which definitions we are using

in brooks's 01986 paper he clearly considers questions like copying 2 gigabytes of data 'accidental' http://worrydream.com/refs/Brooks-NoSilverBullet.pdf

> All software construction involves essential tasks, the fashioning of the complex conceptual structures that compose the abstract software entity, and accidental tasks, the representation of these abstract entities in programming languages and the mapping of these onto machine languages within space and speed constraints. Most of the big past gains in software productivity have come from removing artificial barriers that have made the accidental tasks inordinately hard, such as severe hardware constraints, awkward programming languages, lack of machine time. ... The essence of a software entity is a construct of interlocking concepts: data sets, relationships among data items, algorithms, and invocations of functions. This essence is abstract, in that the conceptual construct is the same under many different representations. It is nonetheless highly precise and richly detailed. ...

so it isn't important what mike acton thinks the terms should mean unless we're trying to understand how he uses them; brooks, moseley, and marks lump space and speed constraints into the category of 'accidental' rather than 'essential', and their arguments need to be interpreted using the definitions they intended to use, not conflicting definitions invented by a youtuber decades later

similarly, people commenting on moseley and marks's paper should be assumed to be using the same definitions as moseley and marks, not conflicting definitions, unless they explicitly state otherwise

Re:Out of the Tar Pit (2006) [pdf] by akkartik on Thursday March 02, 2023 @02:12PM (#35000333)
Totally fair. Sorry, I'm walking in halfway to this conversation with a different axe to grind.
Re:Out of the Tar Pit (2006) [pdf] by kragen on Thursday March 02, 2023 @07:11PM (#35003938)
there's an interesting aspect to recursive decomposition there; an 'essential problem' at one level of abstraction may merely be an accident introduced one level higher up

like, lots of programs are specified to do one or another thing with the filesystem, and have to include extra complexity to do it, but the filesystem is something we introduced and could do without; it doesn't exist in objective reality outside the computer. is that complexity accidental or essential? at the level of the program it's essential (especially if the program is something like find(1) or cp(1), whose job can't be defined at all without presupposing a filesystem) but at the level of the system it's accidental

Re:Out of the Tar Pit (2006) [pdf] by akkartik on Thursday March 02, 2023 @08:17PM (#35004543)
100%

Division of labor: making accidental complexity essential since 1945.

Then again, perhaps we need to account for opportunity cost. Even if persistent storage can take many forms, it's hard to imagine that equivalent features could be 10x simpler. Maybe Chuck Moore would disagree, but his modus is usually to insist you don't need something.. (also totally fair)

Re:Out of the Tar Pit (2006) [pdf] by akimball on Tuesday February 28, 2023 @01:37PM (#34973019)
The optimizer removes that.
Re:Out of the Tar Pit (2006) [pdf] by pletnes on Tuesday February 28, 2023 @02:47PM (#34973891)
Btrfs does stuff like instantaneous snapshots for a multi terabyte size filesystem. I have no idea how they do it, but apparently it’s 100% possible.
Re:Out of the Tar Pit (2006) [pdf] by waynesonfire on Tuesday February 28, 2023 @06:18PM (#34976338)
Well since it's claiming to not mutate state, it must be simple! Go read the code and tell us what you learn.

In the event you find the source code TLDR, indeed it seems implementing an immutable api is complex.

Re:Out of the Tar Pit (2006) [pdf] by kilgnad on Tuesday February 28, 2023 @07:23PM (#34976989)
To see immutability on huge state in action see git.

That is essentially what must be going on under the hood to model mutable state. Every mutation made to a variable is a commit. The only commits that are saved are the ones that have existing references.

Now you're thinking it could be a big memory leak. But you pair this with reference counting you can eliminate the leak.

Essentially when the reference of the earliest commit goes out of scope, the next earliest commit is checked out as the initial root commit and the current commit is freed.

The memory model is then like a moving git window/linked list. Mutations are committed at the tail end while memory is freed at the head.

Re:Out of the Tar Pit (2006) [pdf] by raatuter on Wednesday March 01, 2023 @02:31AM (#34979717)
Immutable data structures are often implemented as persistant data structures, which have the traits of immutability but does not "copy everything on every change" https://en.wikipedia.org/wiki/Persistent_data_structure