2,676 karma · joined Nov 28, 2019 (7y ago) · 1,131 submissions
comment 3y ago · link · parent
>
> I think this is not accurate. Destructors are not
> deallocators, they are supposed to set the object field in
> an invalid state. Now truth is that both are often called
> together, e.g `delete`.
If the object manages some resource other than memory, and if the object's lifetime is intended to guard the resource, then a destructor is needed.
But if the object manages memory only, as is often the case, and all of that memory came from the arena, then you really don't need to call any destructors.
This is the approach taken in one C++ [library][1] I've worked with, where objects represented scalar values to be used en masse for spreadsheet-like applications. In those applications (especially in 32-bit mode), being able to omit an allocator pointer and neglect a destructor call made things smaller and faster.
[1]: https://bloomberg.github.io/bde-resources/doxygen/bde_api_pr...
comment 3y ago · link · parent
One argument I've heard in favor of government-owned industry is for things that must be more or less guaranteed for everybody, regardless of capital.
Drinking water, postal service, election management, and violence (police, national guard, military) come to mind.
Those examples might be more efficient and affordable if privatized, but then it might be expensive or unreliable to get mail in Alaska, or there might be lawlessness near parts of the Mexican border, or elections might be fraudulent in some districts.
Throwing tax dollars, laws, and bureaucracy at these things doesn't necessarily improve them, but maybe it raises the bottom, at considerable cost.
comment 3y ago · link · parent
(grocery_list
(fruit "apple")
(fruit "banana")
(fruit "pear"))
That's pretty much exactly XML. Alternatively: (grocery_list
(fruits "apple" "banana" "pear"))
but the semantics are different.My motivation is expressing docker-compose.yaml in the "best" way I can imagine, as a design exercise. In that case, I'd rather have a bunch of (service ...) forms, instead of a "services" object. Not sure why. Maybe it's a pun on interpreter-driven formats like that used by [guix][1].
[1]: https://guix.gnu.org/manual/en/html_node/Shepherd-Services.h...
comment 3y ago · link · parent
I'm primed to believe this because I'm a registered Democrat raised in that kind of household. Is it true, though? The logic makes sense, but how could we really determine whether a tax-bashing neoconservative actively protects labyrinthine tax practices in order to justify adjacent political ends? I'm more likely to conclude that it doesn't happen.
comment 3y ago · link · parent
If you want your mind blown, read "The Little Schemer" (or the original "The Little Lisper," or another of its variants). I particularly like the section near the end where the Y combinator is (secretly) described. The goal of that book is to "teach you to think recursively." It's not about writing recursive functions at work, but about appreciating the self-referential properties of algorithms.
[1]: https://www.youtube.com/playlist?list=PL8FE88AA54363BC46
comment 3y ago · link · parent
and the Chinese constitution: http://www.npc.gov.cn/zgrdw/englishnpc/Constitution/2007-11/...
It's not about the constitution.
comment 3y ago · link · parent
So, "unfactor" the code and then factor it again. Let's call it... "refactoring."
My $0.02, then, is that "the wrong abstraction" assumes that you are unwilling to change it. What if we were comfortable tearing down our classes all willy nilly and replacing them with some other thing? Is it too risky? Does it hurt too many feelings?
Maybe the problem lies there, instead of in duplicate vs. abstract.
comment 3y ago · link · parent
I don't know, but I can't imagine any other logic.
Maybe posting the price they'd like to charge would scare away almost all interested parties.
Maybe the price they charge you depends more on how much money they think you have than it does on a market's "decision" on what the product is worth.