Details
-
AboutChief Procrastination Officer, Keeper of The Keys to My Father's Flat, proud holder of a mediocre BSc. Analytical fundamentalist Manufactured: Budapest, 2001 Calories: 70,000 May contain traces of other viewpoints Matrix: @lbfalvy.matrix.org
-
SkillsTypescript, C#, Rust, Orchid, goofy altlangs, group theory
-
LocationBudapest, HU
-
Website
-
Github
Joined devRant on 5/18/2018
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API

From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
-
@jestdotty Vec has pop_if which removes the last element if a predicate succeeds, and VecDeque has pop_front_if and pop_back_if, so I guess the rationale was that removing the first element is a relatively uncommon operation anyway because of how expensive it is.
-
@jestdotty I see what you mean with remove,. I guess it would be reasonable for it to return a Result. Either way, none of these safe micro-functions are terribly important, since they're trivial to implement for yourself.
-
@jestdotty You can't peek at the first index and then choose whether to take it because you can't mutate the vector while holding a ref to an element. If vector specifically supported this use case, it would be implemented the same way you would implement it externally, except the function that does it would need a closure argument and like 4 generic parameters (two distinct lifetimes, I think one might be implicit). If it's any consolation, the second unwrap will definitely be optimized out
-
@jestdotty vec.remove(index) is absolutely a thing.
https://doc.rust-lang.org/std/vec/...
Keep in mind that since you can't have a hole in a vector, this will shift the end of the vector down an index. If you want holes in your vector, consider a Vec<Option<T>> and vec[index].take() -
@Demolishun Pattern matching like in Haskell, Rust, C#, Java, etc. Most modern languages more-or-less agree on the meaning of the word, afaik python doesn't have it at all.
Passing a function by name is far less ergonomic for the purpose of Option. Why would I want to name a block that isn't any more special than the body of an if statement? -
@retoor they can't contain statements, just one expression.
-
@retoor I guess since Python fully supports neither lambdas nor pattern matching, you actually can't make an implementation of optional as ergonomic as it is in other languages, so this may be the closest Python can get to that.
-
@retoor for a single operation it doesn't really cause problems I guess because the source of the error is unambiguous, but I don't see the benefit either. It just looks to me like a clumsy substitute for optional/maybe.
-
@retoor I checked upfront of course, the exception is a null reference in this case, but even if it was a custom empty collection error, it would be difficult to assert that I'm not associating my handler with other error conditions from other collection operations for which it's incorrect.
I think the only case when handling an exception is preferable to preventing it is if the enclosing scope and the exception type fully specify the handler's duties. If the handler would need to assume anything about the line that raised the exception, checking first is better.
Obviously not considering APIs that abuse exceptions to represent non-exceptional, fairly likely outcomes, such as a missing file or network failure. -
@antigermanist it isn't input, it's from a database previously populated by earlier versions of the same software, with all sorts of constraints ranging from high level business rules (eg. "a product is usually built from at least one part") to low level implementation guarantees (eg. "BOM nodes store the ID of their parent", "exactly one parent ID in a given BOM is null", "The child-parent graph is loop-free")
Both are subject to change. -
it's still a matter of perspective. Who''s to say that reality is described by a concrete set of axioms and not something entirely more complicated that subsumes the relation between sets of axioms and their corresponding sets of true statements, which we are discovering right now?
I think that with our understanding of mathematics based entirely on set theory, it's essential to avoid the implication that the axioms of set theory are special in any way and not an arbitrary choice that generates a useful set of true statements. -
well seeing as parallel writes tend to tank write performance, I''d say it's a good idea either way, even on a modern FS that manages fragmentation.
Unless you can rely on the disk being an SSD which has goofy magic firmware tricks I don't plan to ever learn. -
which cve?
-
now that you mention it, an 8 hour flight + 3 hours commute once per year, both ways, still only equals about two weeks on-prem, or equivalently about 1 day per month on-prem. It also excludes people who can't afford any on-prem. Food for thought.
-
The real reason is that Apple is deliberately breaking basic web functionality constantly specifically to force developers into the app store while making a potential antitrust lawsuit as complicated and unpredictable as possible.
-
@Lensflare That was never needed for webapps. The legacy solution is HTTP caching headers with a really long TTL, the modern* solution is a caching service worker.
*13 years old -
I disable them everywhere immediately because they just annoy me, but KDE really screwed something up because even I remember it as a poorly animated GUI despite having spent cumulatively maybe an hour with animations enabled over the past 8 years of daily driving plasma.
-
The gaps between measured reality and our current best predictions drive scientific progress and the best we can hope to achieve is to replace them with new ones. An unknown force that allowed us to survive against our predictions isn't any more godlike than abiogenesis or the strong interaction.
-
I don't think our understanding of the world is anywhere near good enough to estimate the probability of our survival throughout history. Every equation I'd seen so far for this purpose involves mostly coefficients we can't even begin to credibly reason about, and a few that are hotly debated with vastly different value candidates.
-
@antigermgerm He's there to pinch my ear when I've been talking for too long.
-
every shitty startup that's funded by an incubator or other investment firm is shoveling money out of hedge funds and into the economy.
-
anyone remember when the author's previous employer declared that they own NGINX because he wrote it on a company laptop? What was the end of that story?
-
@jestdotty Yeah. SemVer doesn't really indicate the significance of changes, that's part of why it's not popular for user-facing software. New features, even if they introduce shortcuts that replace most of everything you were doing before, don't force a major change, as long as the old methods work. Ideally, SemVer majors actually don't include any features, because it's enough trouble dealing with the fallout. They only remove deprecated APIs, and add tiny tweaks that subtly change the correctness or meaning of old calls. This is the complete opposite of what most people perceive as 'significance'.
-
@jestdotty worlds can always be migrated forward, at least in Minecraft. Is it really whether a change is "breaking" that matters for you, or is it how substantially the change affects the intended gameplay sequences?
-
And that''s why all of our programs are doomed to forever support Excel as a data format even though Excel has CSV exports.
-
But I guess I see your point.
-
@AlgoRythm Odd, the only reason I ever stayed on an older version was for modding and servers (which stayed on an older version for plugins). It never occurred to me to stay on an older version of the game for itself.
-
@AlgoRythm I guess not, but if it was a major update, would you have stayed on the older version just to avoid this?
-
That story was an anecdote from before my time, but shit like this is constant. Semver is a curse enough on library development. Don't force it on projects that aren''t libraries.
-
The only thing I hate more than breaking compat is assuming compat where none was ever promised. No I will not fucking move my functions out of the class because Daniel from engineering unilaterally decided that the order and number of functions in my interface can be manually mapped to COM member function indices.