Questions tagged [contract]
424 questions
11
votes
2 answers
C++2a contract programming and compilers
I'm interested in studying the recently accepted contract programming for C++20 for learning and investigation purpose.
As I'm looking around for compiler support, I'm disappointed to not find any. Both gcc and clang are quite clear they do not…

Cyan
- 13,248
- 8
- 43
- 78
9
votes
2 answers
Removing the "integration test scam" - Understanding collaboration and contract tests
I've recently watched Integration Tests are a Scam by J. B. Rainsberger and am now looking for more material on the subject. I have to say, I'm shocked by how much we're doing wrong, (i.e. integration testing when we should unit test), intrigued by…

Pete
- 10,720
- 25
- 94
- 139
9
votes
2 answers
Portable / Interoperable WCF Contracts
I was wondering if anybody out there had some good tips/dos and don'ts for designing WCF contracts with a mind for web-service interoperability, both in terms of older Microsoft web service technologies (e.g. WSE) and non-Microsoft technologies…

Randolpho
- 55,384
- 17
- 145
- 179
9
votes
8 answers
How can I place validating constraints on my method input parameters?
Here is the typical way of accomplishing this goal:
public void myContractualMethod(final String x, final Set y) {
if ((x == null) || (x.isEmpty())) {
throw new IllegalArgumentException("x cannot be null or empty");
}
if…

Robert Campbell
- 6,848
- 12
- 63
- 93
8
votes
1 answer
Contract.Requires vs Contract.Require
I noticed that Microsoft named their code-contract-relative functions in .NET 4 in a strange manner.
They add "s" at the end of "require" and "ensure", so there are Contract.Requires() and Contract.Ensures(), but not at the end of "assert" and…

ani
- 81
- 2
6
votes
4 answers
How can I enforce a contract within a struct
I'd like to enforce a struct to always be valid regarding a certain contract, enforced by the constructor. However the contract is violated by the default operator.
Consider the following, for example:
struct NonNullInteger
{
private readonly…

user703016
- 37,307
- 8
- 87
- 112
6
votes
6 answers
What do I need to know before I sell a software license?
I've developed a web-based application that a company is interested in licensing. I suspect they intend to appropriate the features they want, and add to their existing codebase, so a license is likely to be a one-time affair. Since it's interpreted…

scottburton11
- 251
- 4
- 12
6
votes
1 answer
definition of base has to precede definition of derived contract
I have two different files which are Project1.sol and Project2.sol
Project2.sol is like:
import "./Project1.sol";
contract Project2{
address newProject1Address =address(new Project1());
}
Project1.sol is like:
import…

jazz kek
- 94
- 2
- 8
6
votes
2 answers
AndroidResultContracts.TakePicture() returns Boolean instead of Bitmap
The contract has been changed to return Boolean instead of Bitmap starting in androidx.activity version 1.2.0-alpha05. How can I use the Boolean returned by the built in AndroidResultContracts.TakePicture() contract to access and display the photo…

Sampson
- 662
- 6
- 17
6
votes
1 answer
Network up to date on truffle deploy
I've been working with solidity and truffle for a few days to develop a contract. I'm testing using the network created by Ganache an RPC client for build a local blockchain enviroment.
There is one thing I do not understand though.
I follow these…

Alberto Favaro
- 1,824
- 3
- 21
- 46
6
votes
2 answers
How do I update my free apps when Apple ask me to "Review the updated Paid Applications Schedule"?
Summary: Do I need to accept the "Paid Applications" contract from Apple on iTunesConnect to update my free apps? If not, what are the steps I should follow to update my free app?
Details:
I'm trying to update a free app. I login to iTunes Connect…

Henry Yang
- 2,283
- 3
- 21
- 38
5
votes
2 answers
How to get random number in Solana on-chain program?
I have just jumped in Solana on-chain program.
I am going to make coin game which judge frontside or backside.
I tried to use std:: rand and get_random crate but they don't work.
If you have experience about it, please let me know.
I use anchor for…

David Nasaw
- 149
- 2
- 9
5
votes
3 answers
PACT .NET consumer test: flexible length array
I am using pactNet to test an API which should return an array of a flexible length.
If i call "myApi/items/" it should return a list of items where the consumer does not know the exact size of.
So the answer should look like this:
[
{
…

Kevin Schäfer
- 53
- 5
5
votes
4 answers
Should hashCode() only use the subset of immutable fields of those used in equals()?
Situation
I needed to overwrite equals() and as it is recommended I also overwrote the hashCode() method using the same fields. Then, when I was looking at a set, that contained only the one object I got the frustrating result…

aryavie
- 59
- 4
5
votes
1 answer
Getting the length of public array variable (getter)
I am trying to get the length of array from another contact. How?
contract Lottery {
unint[] public bets;
}
contract CheckLottery {
function CheckLottery() {
Lottery.bets.length;
}
}

RFV
- 831
- 8
- 22