Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Activity for Derek Elkinsâ€
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #290661 | Initial revision | — | 12 months ago |
Answer | — |
A: How to write a function that only accepts a list of `Error string` `Results` in F# on the level of types? I'm pretty sure the answer is "no", especially in some reasonable way. If `Result` was defined in some object-oriented way, i.e. as an interface with `Ok` and `Error` being implementations of that interface, or if this was O'Caml and `Result` had been defined as a polymorphic variant, then you could ... (more) |
— | 12 months ago |
Edit | Post #289975 | Initial revision | — | about 1 year ago |
Answer | — |
A: How to implement a relationship between 2 tables where the type of participation is mandatory and RESTRICT rule for both? I would need to check, but I don't think PostgreSQL or most (any?) relational databases have a good way of expressing this "at most 8" constraint. It may be possible to express it in some way but probably not in a good way. For example, you could use triggers, but those have significant issues with r... (more) |
— | about 1 year ago |
Comment | Post #289948 |
The structure of this question is kind of awkward. For example, let's say these *were* all the options. Are you expecting an answer that's just, "Yes, those are all the options"? What I think your actual question is is "what is a *good* software architecture for your problem".
That said, you haven... (more) |
— | about 1 year ago |
Comment | Post #289443 |
Feel free to remove the parts those first paragraphs address, and I will remove those paragraphs.
As for "bias", why would you expect a tool purpose-built to do a specific task to not be better at that task than tools not purpose-built for that task? The "problem" with `pipx` is that it is not abl... (more) |
— | over 1 year ago |
Edit | Post #289443 | Initial revision | — | over 1 year ago |
Answer | — |
A: What is the point of pipx? Well, to start, it is not an alternative to `pip`. It's built on top of `pip` and exclusively deals with applications. `pip` is more of a development tool, while `pipx` is aimed at end-users (who may also be developers). The bulk of your question seems to be complaining that loose analogies aren't... (more) |
— | over 1 year ago |
Comment | Post #289327 |
Do you have an example of "re-entrant" being used this way, e.g. a link to a place where it is used this way? I have never heard "re-entrant" to mean "has no side-effects" and would never use it that way myself as it would be unclear and confusing. While far from perfect, the [Wikipedia page](https:/... (more) |
— | over 1 year ago |
Comment | Post #289327 |
Reentrancy definitely does not mean a function has no side-effects, let alone that it is thread-safe *because* it has no side-effects. Indeed, the archetypal example of a procedure you'd want to be reentrant is an interrupt service routine triggered by an external device which *must* perform side-eff... (more) |
— | over 1 year ago |
Comment | Post #289251 |
I think there are better and worse ways of creating question to be self-answered. The best way is to have a question that you were going to ask but answered before you asked. Next best is to closely model the question off of a real question.
Here, you play a character who comes off as having no un... (more) |
— | over 1 year ago |
Comment | Post #289263 |
The distinction you mention is 1) not the main (or arguably even *a*) distinction between statements and expressions, 2) it's certainly not widely used, and 3) as you mention yourself there are plenty of exceptions.
Most programming languages specify the evaluation order of subexpressions, some, s... (more) |
— | over 1 year ago |
Comment | Post #289229 |
I'll add this here since it is somewhat in the vein. I've downvoted because, while your answer does touch on the main idea separating statements and expressions, it presents it as a comprehensive definition and not the rough intuitive bucket that it is. As Moshi's answer correctly states, what is an ... (more) |
— | over 1 year ago |
Comment | Post #288787 |
+1 Simpler answer than mine. (more) |
— | over 1 year ago |
Comment | Post #288771 |
If I'm understanding your code correctly. You are equating car IDs with user IDs. Instead you should be relating (car ID, user ID) *pairs* with other (car ID, userID) pairs. Loosely (the following isn't to be taken literally), you should have things like `remsp(p, (current_car_id, current_user_id), (... (more) |
— | over 1 year ago |
Comment | Post #288771 |
I don't quite understand your comment, specifically "{1,2,3} have to be in one set, and {a,b} as well". The equivalence relation is on the pairs, not the IDs, and it does equate (1,a) and (3,b) in this case. Note that the equivalence relation is the one *generated* by the relation I specified, which ... (more) |
— | over 1 year ago |
Edit | Post #288771 | Initial revision | — | over 1 year ago |
Answer | — |
A: How do I find disjoint sets in a dataset One way of specifying what you want is that you want the equivalence classes of the equivalence relation generated by saying that pairs (a, b) and (x, y) are equal when either a = x or b = y. The famous union-find algorithm solves exactly the problem of incrementally computing representatives for an ... (more) |
— | over 1 year ago |
Edit | Post #288224 | Initial revision | — | over 1 year ago |
Answer | — |
A: When is it OK for duplication of information between message header and payload in a distributed software application? Nowadays DRY is usually with regards to code, not data. Regardless, even for data, DRY does not outlaw duplication, it just requires a single "authoritative" copy. There are certainly similar ideas for data in relation to database normalization. I don't think either are terribly applicable here. I... (more) |
— | over 1 year ago |
Comment | Post #287632 |
And yet here we are with someone caught off guard by them. Most languages don't do what Python does and JavaScript, which has/had vaguely similar scoping to Python's, has moved away from this and toward block scoping.
If declarations change the behavior of the code, then they are not useless. The ... (more) |
— | about 2 years ago |
Edit | Post #287632 | Initial revision | — | about 2 years ago |
Answer | — |
A: What's causing mypy to give an `[assignment]` error in this nested for loop? As the error message indicates, the assignment is to the variable `row`. The `for` loop will repeatedly assign to `row`. But why is there a problem? Because Python's scoping rules are bad/broken. There is no block scoping. The scope of any variable within a function is that entire function except ... (more) |
— | about 2 years ago |
Edit | Post #287617 |
Post edited: typo |
— | about 2 years ago |
Edit | Post #287617 | Initial revision | — | about 2 years ago |
Answer | — |
A: When would one not want to return an interface? From simple subtyping concerns, you want the arguments of your methods to be as abstract/imprecise as possible while still allowing you to efficiently accomplish your goals. This allows your method to be used in the broadest range possible, and it also makes it clear what exactly your method depends ... (more) |
— | about 2 years ago |
Edit | Post #287616 | Initial revision | — | about 2 years ago |
Answer | — |
A: How to inject environment configuration values when deploying an Angular application in Kubernetes or similar infrastructure? I'm not quite sure I see what the issue is. As far as I can tell, you could continue to do exactly what you're doing now, you'd just do the token replacement on the `bundle.js` when a container is provisioned. On the other hand, I can see why you might want to move away from this approach. A more ... (more) |
— | about 2 years ago |
Comment | Post #286975 |
@Lundin "For the most part" is not the same as "always". There can be (and likely are) implementations where this is not the case, such as [the executable specification in the K Framework](https://github.com/kframework/c-semantics) explicitly designed to catch undefined behavior. As in your answer, t... (more) |
— | over 2 years ago |
Comment | Post #286975 |
While it's not uncommon to simply (stack) allocate space for local variables, so that their value is based on whatever was in that space on the stack, this is not specified by the standard. Talking about implementation details like this is often misleading for C (and C++). The standard allows a much ... (more) |
— | over 2 years ago |
Comment | Post #286940 |
Don't you see? The screenshot clearly shows one vector ending before the other. Ignore the fact that the components of the vector take up different amounts of textual space... (more) |
— | over 2 years ago |
Edit | Post #286899 | Initial revision | — | over 2 years ago |
Answer | — |
A: Why is boolean value f (false) defined as a parsing-word while t (true) is not in Factor? The answer is indicated on the page for `f`. Specifically, "[t]he `f` object is the singleton false value, the only object that is not true." In contrast, `t` is defined simply as `SINGLETON: t` where `SINGLETON:` defines a class and thus a class word which is the sole instance of that class (i.e. it... (more) |
— | over 2 years ago |
Edit | Post #286818 | Initial revision | — | over 2 years ago |
Answer | — |
A: What is the Python Global Interpreter Lock? The Python Global Interpreter Lock (GIL) is a mutex in the primary Python implementation (CPython) that is acquired whenever Python (byte)code is executing. This means within a single (OS) process only one (OS) thread can be executing Python code at any point in time. This is absolutely an impleme... (more) |
— | over 2 years ago |
Edit | Post #286676 | Initial revision | — | over 2 years ago |
Answer | — |
A: What allows a string slice (&str) to outlive its scope? There are two things going on here. One which technically explains what's going on fully, and another potential misconception you have. For the former, `&T` implements the `Copy` trait regardless of what `T` is. So all that's happening is when `r = inner;` executes it just does a bitwise copy of t... (more) |
— | over 2 years ago |
Edit | Post #286551 | Initial revision | — | over 2 years ago |
Answer | — |
A: Is it possible to undo a git reset? If you've committed, then the commit is in the git repo regardless. All `git reset` does is change what commit the `HEAD` references. If you find the hash corresponding to the commit you'd like `HEAD` to reference, you could just `git reset --soft `. `git log --reflog` should list all the commits... (more) |
— | over 2 years ago |
Comment | Post #286511 |
While there are some aspects that seem like a bad idea generically, e.g. having `State` depend on `StateMachine`, it's hard to judge what advice to give without knowing what you're trying to accomplish. For example, a state machine used in the implementation of a regex engine has very different requi... (more) |
— | over 2 years ago |
Comment | Post #286411 |
I suspect this isn't really an answer to your question, but implicit methods can usually give some strong guarantees about being closed surfaces. For example, signed distance fields inherently can't have "gaps". They can have "singularities" but I don't think that's much of an issue in practice. Thes... (more) |
— | over 2 years ago |
Comment | Post #286400 |
What you're describing is simply a violation of the LSP (Liskov Substitution Principle) and has nothing to do with `const`ness. The scenarios you describe (both specific and generic) are ones where there is no possible `const` implementation that doesn't violate the LSP. The problem is C++ provides n... (more) |
— | over 2 years ago |
Comment | Post #285974 |
Separately, I didn't complain about C's type system. If anything, the allowance of non-`void` `_Noreturn` functions is nicely in line with theory. At worst, I implied that `void` could be better named. I certainly could complain about aspects of C's type system and design in general. I don't really... (more) |
— | almost 3 years ago |
Comment | Post #285974 |
C is not "very close to actual machine code". (This is obviously true because C is used on a huge variety of machines, but even for mainstream CPUs it's become ever more divergent from what's actually happening.) The notion of a "stack" is not a concept in C, which is good since C is deployed on CPUs... (more) |
— | almost 3 years ago |
Comment | Post #285974 |
I don't see what your getting at. The fact that there are cases where you want a `void` returning `_Noreturn` function doesn't mean there aren't cases where you want a non-`void` returning `_Noreturn` function. Where non-`void` returning `_Noreturn` functions would most obviously be useful is for fun... (more) |
— | almost 3 years ago |
Comment | Post #285974 |
From a (type) theoretical perspective, not only is it sensible but it's quite natural to have non-returning functions of any type. Type theoretically, a type with no values is usually called `Void` (not to be confused with C's `void` which, type theoretically, is usually called "unit" and has exactly... (more) |
— | almost 3 years ago |
Edit | Post #285945 | Initial revision | — | almost 3 years ago |
Answer | — |
A: Measuring arithmetic overflow checking overhead in C# Benchmarking is hard and there are a lot of potential issues with your code. I agree with Olin Lathrop that you want at least a few seconds worth of run time, not just due to the potential for a low precision clock but also to deal with noise from various sources. However, there are still other pr... (more) |
— | almost 3 years ago |
Edit | Post #285879 | Initial revision | — | almost 3 years ago |
Answer | — |
A: What are the drawbacks of using data snapshot testing? This is more or less equivalent to a long used testing technique that I've commonly heard referred to as gold filing. The benefit of it is that it is very cheap to do, and it can catch even minor changes that you may not have covered with a typical unit test. Two pitfalls I'll focus on are: Go... (more) |
— | almost 3 years ago |
- ← Previous
- 1
- 2
- 3
- 4
- Next →