9,406 reputation
12141
bio website
location
age
visits member for 3 years, 8 months
seen 1 hour ago

May
25
comment OSS dual licensing / market segregation
If the license does not permit use for business, it's not an open source license under any commonly accepted definition of the word. Not even if you exempt some kinds of business. To quote a common definition from memory, open source licenses don't discriminate based on use case. There are of course licenses that only allow non-commercial use, but they're not open source or free as in free speech.
May
24
comment Why isn't Haskell able to optimize infinite lists?
@MartinHaTh If you're going to use Haskell you better know that [T] is a linked list. You need to know that for any list traversal that isn't just a composition of existing higher order functions, and you need it to reason about the time and space complexity of programs handling lists. It's impossible (and too much work if it was possible) to know beforehand what's "obvious" to you (or any other person) and implement optimizations just to not surprise you. It's better to break your expectations and have you learn something in the process. Now you know that optimizations aren't perfect ;-)
May
24
comment Why isn't Haskell able to optimize infinite lists?
@MartinHaTh Unused variables aren't due to misconceptions of developers, they're mistakes that happen while coding. Any Haskell programmer (actually any programmer) worth their salt knows that linked lists need linear time for indexed access, and that compiler optimizations isn't magical fairy dust. There are certainly people who don't yet know that, but since we can't possibly optimize every (or even most) infinite list with an "obvious" pattern, we're doing these people a disservice by not correcting their misconception early and consistently.
May
24
comment Why isn't Haskell able to optimize infinite lists?
@MartinHaTh Warnings about unused variables exist because experience shows that people do that unintentionally and that it indicates bugs or poor code quality. Detecting unused variables (a subset of dead code elimination) is a useful optimization, partly because it cleans up the code after other optimizations have made the variable redundant (e.g. by replacing its use with its known-constant value).
May
24
comment Why isn't Haskell able to optimize infinite lists?
@MartinHaTh For the case of enumFromThen a b with variable a, b, it's easy (a + (b-a)*n or something). But this is a special case that has to be devised by humans and implemented specifically, and it could takes some care to apply (it must fire before enumFromThen is inlined). All such transformations take time to implement, make compilation ever so slightly slower, result in code that has to be maintained. An optimization that adds no value has negative value because of these costs.
May
24
answered Why isn't Haskell able to optimize infinite lists?
May
23
comment Does this Decorator implementation violate the Liskov Substitution Principle?
@Prog Absolutely (if by "return all the strings" you mean in the same order). The client code was either too accepting (too broad, too liberal) by asking for a WordBank (perhaps there is some subtype which does guarantee original order), or it misread the contract. Either way it's a problem with the client code and need to be fixed there.
May
23
comment Does this Decorator implementation violate the Liskov Substitution Principle?
@Prog Yes, that sounds good. I also added an example to the answer.
May
23
revised Does this Decorator implementation violate the Liskov Substitution Principle?
added 204 characters in body
May
23
comment Does this Decorator implementation violate the Liskov Substitution Principle?
@Prog Again, it completely depends on the contract of WordBank. The sole fact that it returns different data (assuming WordBank wasn't abstract) is not a problem. It would be quite silly to mandate that subtypes are identical. They only must be compatible and what's compatible depends entirely on what you're doing. It's up to the person defining WordBank. If they say a WordBank returns the same words in the same order, it's an LSP violation. If they say a WordBank returns a subset of the word in arbitrary order, then it's fine. It's a weaker contract but a valid and useful one.
May
23
revised Does this Decorator implementation violate the Liskov Substitution Principle?
added 324 characters in body
May
23
comment Does this Decorator implementation violate the Liskov Substitution Principle?
@BobDalgleish Read my answer for what I have to say on LSP and the question. My point towards you is that the data offered may or may not count as a change of behavior, depending on what constraints the supertype sets on the values offered.
May
23
answered Does this Decorator implementation violate the Liskov Substitution Principle?
May
23
comment Does this Decorator implementation violate the Liskov Substitution Principle?
@BobDalgleish Nearly everything interesting about a program's behavior revolves around the data it handles. Output routines need to be fed data, computations turn data into other data, control flow can depend heavily on data, and once you leave the cozy warmth of structured programming, even code itself (or at least behavior in the form of polymorphism) is data. When a List<int> starts ignoring the data put into it and instead always contains 17 copies of the number 42, every nontrivial program using List<int> goes haywire.
May
23
comment What Kind of Source Control Do High Security Projects Use?
@MichaelKohne I know and it's a great thing when you're properly paranoid. But it doesn't touch on anything I mentioned. When some engineer shouldn't even be able to read the code, they obviously shouldn't clone the repository either. When they have access, you might as well let them make clones in secure locations. Access management is, as you mention, pretty VCS-agnostic by keeping separate repositories.
May
23
comment What Kind of Source Control Do High Security Projects Use?
It's very debatable if preventing copies of source code does anything at all for security/secrecy. There's certainly an argument to not allowing copies all over USB sticks, laptops, etc. spread over the entire globe and prone to theft, but this can be addressed by leaving all copies (repositories) on hardware that remains inside secure facilities. Are we being paranoid and assume any developer working on the code is a potential leak?
May
23
answered Best way to find whether a collection does or does not contain an element with a specific desired quality
May
23
comment Where to implement thread-safety logic for my queue data structure?
Are you aware that the Python standard library has a perfectly good and thread-safe queue? What makes your queue so special that you can't use the general-purpose one?
May
22
comment How significant is the impact of the type system (static/dynamic) on the overall design of programs?
@Doval The Algol and C languages are several decades old. They are traditional in the sense of carrying inertia and having influenced the development of the field, but not traditional in the sense of being deeply rooted and without rival, for the purposes of this question. My point is that there should be enough code using (and general experience with) the rich static type systems you mention to make an answer feasible.
May
22
revised How significant is the impact of the type system (static/dynamic) on the overall design of programs?
Remove meaningless distinctions not asked about