9 votes

Proving program correctness under all possible cases

Ensuring correctness of a computation mathematically is quite possible, just enormously expensive. Basically, you have to set down the requirements in a formal semantic system that is as rigid as a ...
Kilian Foth's user avatar
5 votes
Accepted

Single code fragment to perform two different operations

What you are describing sounds like you want something similar to the relationship between a DateTime and a TimeSpan. Perhaps you could describe it as a Note and a NoteShift. I think that calling it ...
Berin Loritsch's user avatar
4 votes

Java - Does extending a class which itself extends a class which itself... and so on... is healthy..?

To answer your questions directly: 1) No, it will not affect performance much. Generics are mostly erased by the time the program gets executed anyway, so the additional cost is really only multiple (...
Ordous's user avatar
  • 1,927
3 votes

Proving program correctness under all possible cases

First you have to know what a "bug" is. In some projects this might be rigorously defined, in other projects it might be "I do not like the color". And opinions will differ about ...
JonasH's user avatar
  • 4,833
3 votes

Alternative To Generic Methods where Type is known at runtime

Curry generics Since you don't want to use reflection to call generic methods, I'll give you an alternative: Curry the generic parameter. I hope that makes sense. To handle operations that depend on ...
Theraot's user avatar
  • 9,131
3 votes

Differences between streams and iterators in C++?

I hope it's not poor form to answer my own question, but upon trying to implement a LogicProgramAnswersetIterator, I ran into some problems that lead me to think either I would have to go to "heroic" ...
Dennis's user avatar
  • 196
3 votes

Differences between streams and iterators in C++?

Take a look at the documentation - specifically the category table and the stream iterators section. The stream iterators all belong to the InputIterator or OutputIterator categories (only the first ...
Useless's user avatar
  • 12.6k
2 votes

I've a doubt regarding Environment Model of execution

Yes, the concept of an “environment” is a language independent concept. The term is used frequently in programming language theory, though “bindings” is more generic: names are “bound to” something, ...
amon's user avatar
  • 134k
2 votes

How should I provide generic typing and allocation for a collection library in C?

How should I provide generic typing and allocation for a collection library ... ? Establish boundaries Without scope limits, this task will evolve into a re-creation of C++. Assuming that is not the ...
chux - Reinstate Monica's user avatar
1 vote

Proving program correctness under all possible cases

It seems noone here answered your literal question: Is it possible to know all possible defects in a program before I write a single line of code For this question, the answer is trivial: it is ...
Doc Brown's user avatar
  • 207k
1 vote

Single code fragment to perform two different operations

The most elegant way to do this is to represent an OctiveNote as an integer. This is in swift but it should be easy to translate: enum Note: Int { case c, d, e, f, g, a, b } struct OctiveNote { ...
Daniel T.'s user avatar
  • 3,043
1 vote

Alternative To Generic Methods where Type is known at runtime

Classes that implement IEnumerable<T> also implement the non-generic interface IEnumerable, so you can just use that. Change this: private async Task<Ienumerable<?>> ...
John Wu's user avatar
  • 26.5k
1 vote
Accepted

Templates for generic code and code flexibility

This is part of why most of the standard library deals in iterators rather than dealing directly with containers themselves. Iterators were designed from the beginning to support iteration over the ...
Jerry Coffin's user avatar
  • 44.5k
1 vote

Adjective for function types on wether the values are received or sent

The set of valid inputs to a mathematical function is the domain, and the valid outputs the codomain or range. These should more or less equate to the values contrained by the types of your sent/...
jk.'s user avatar
  • 10.2k
1 vote
Accepted

Definition of Generic function

There are several meanings to "generic". Informal definition "generic" in everyday language something that shares common properties but is less specific in some ways. Under this perspective, ...
Christophe's user avatar
  • 77.2k
1 vote
Accepted

Wrapping Controller / ApiController to remove boilerplates

Its fairly common to use a custom BaseController from which your other controllers inherit rather than Controller. I dont think there is any particular danger here. However! I have to agree that its ...
Ewan's user avatar
  • 75.6k
1 vote

Wrapping Controller / ApiController to remove boilerplates

You are doing it wrong. Your approach simply violates the Interface Segregation Principle which says No client should be forced to depend on methods it does not use Imagine if I have a controller ...
rexcfnghk's user avatar
  • 183
1 vote
Accepted

What is the reason behing Tuples instead of HList in akka-http

On https://gitter.im/akka/dev, Konrad Malawski writes: It's about the horrible error messages that one gets if things go wrong with HLists not depending on shapeless, so people can use ...
Robert Harvey's user avatar
1 vote

Java - Does extending a class which itself extends a class which itself... and so on... is healthy..?

If it is a little confusing to you, it's a problem. Someone unfamiliar to the code (which will probably be you in 2 months) will be utterly baffled. From the look of your code, you are letting ...
Bill K's user avatar
  • 2,739

Only top scored, non community-wiki answers of a minimum length are eligible