contract

C++2a contract programming and compilers

无人久伴 提交于 2019-12-03 13:22:31
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 support this feature within their --std=c++2a mode. Since the approval is pretty recent, I'm not too surprised that current compilers do not support the exact semantic proposed. What is more surprising to me though is that there is absolutely nothing, not even a compiler-specific extension which would mimic, even in a limited way, the same feature. I

Portable / Interoperable WCF Contracts

丶灬走出姿态 提交于 2019-12-03 12:38:38
问题 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 such as Java calling WCF web services. For example: are there any special rules that need to be taken into account when exposing DateTime as a type in your contract? How about Dictionaries and Hashtables? What are the issues you might run into with the

Are there null like thing in solidity

淺唱寂寞╮ 提交于 2019-12-03 05:00:21
struct buyer{ uint amount; Status status; } mapping(address=>buyer) public buyers; mapping(uint=>address) buyerIndex; uint public buyerNum; //Order a product. function(){ uint doubleValue=value*2; uint amount=msg.value/doubleValue; if(buyers[msg.sender]==null){ //Error in this line buyer abuyer=buyer({amount:amount,status:Status.Created}); //Error in this line buyerNum++; buyerIndex[buyerNum]=msg.sender; buyers[msg.sender]=abuyer; }else{ buyers[msg.sender].amount+=amount; } Order(msg.sender,amount*doubleValue,amount); } If a buyer is not recorded in the buyer mapping, then buyerNum++; but I

Portable / Interoperable WCF Contracts

血红的双手。 提交于 2019-12-03 03:52:26
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 such as Java calling WCF web services. For example: are there any special rules that need to be taken into account when exposing DateTime as a type in your contract? How about Dictionaries and Hashtables? What are the issues you might run into with the various bindings available? WCF DateTime woes Regarding your DateTime question, you are right to be

Core data: Managing employee contracts in a many-to-many relationship?

不打扰是莪最后的温柔 提交于 2019-12-01 14:04:00
I am mapping an idea for a relationship using Core Data. I have an Employer entity who has a many-to-many relationship with Employees . Basically, an employee can work for multiple employers, and an employer can have multiple employees. The problem I'm facing is, I'm not sure how to manage the contracts between employees and employers. As an employee can work for either 1 or many employers, they would naturally have a contract for each employer they work for (complete with salary, duration) and a list of dates when they are working for a specific employer. My question is - how to manage the

Add contract to interface implementation

大憨熊 提交于 2019-12-01 09:25:40
I understand that I cannot add preconditions on an interface implementation. I have to create a contract class where I define contracts on elements that are seen by the interface. But in the following case, how can add a contract on an internal state of the implementation that is therefore not known at the interface definition level ? [ContractClass(typeof(IFooContract))] interface IFoo { void Do(IBar bar); } [ContractClassFor(typeof(IFoo))] sealed class IFooContract : IFoo { void IFoo.Do(IBar bar) { Contract.Require (bar != null); // ERROR: unknown property //Contract.Require (MyState != null

Add contract to interface implementation

微笑、不失礼 提交于 2019-12-01 07:05:00
问题 I understand that I cannot add preconditions on an interface implementation. I have to create a contract class where I define contracts on elements that are seen by the interface. But in the following case, how can add a contract on an internal state of the implementation that is therefore not known at the interface definition level ? [ContractClass(typeof(IFooContract))] interface IFoo { void Do(IBar bar); } [ContractClassFor(typeof(IFoo))] sealed class IFooContract : IFoo { void IFoo.Do

Is there an beautiful way to assert pre-conditions in Java methods?

心不动则不痛 提交于 2019-11-30 12:17:40
A lot of my functions have a whole load of validation code just below the declarations: if ( ! (start < end) ) { throw new IllegalStateException( "Start must be before end." ); } I'd like to precisly specify the valid ranges of certain inputs - for example a A > B, C => 1 or str_d.length() > 0. Given that some of my functions have quite a lot of arguments which must be validated I can end up writing a lot of boiler-plate just to validate the pre-conditions. I'm writing a library which is mainly going to be used by non-technical developers, we've found that validating function inputs is the

Where do smart contracts reside in blockchain (Ethereum or Hyperledger)

你离开我真会死。 提交于 2019-11-30 02:07:16
So, let us consider a typical trade finance process flow. Exporter deploys a contract that has conditions of the shipment and a hash is generated once the deployment is finished. Questions: 1) Where is the contract stored? 2) How other participants such as customs and importer can access this contract? 3) Can we activate participant level access to the contract on the blockchain? There are several aspects to Ethereum and Hyperledger which make them quite different. Let me give a somewhat simplified answer to not get into too much details and a too long answer. First of all, Ethereum is

Is there an beautiful way to assert pre-conditions in Java methods?

北城余情 提交于 2019-11-29 17:53:04
问题 A lot of my functions have a whole load of validation code just below the declarations: if ( ! (start < end) ) { throw new IllegalStateException( "Start must be before end." ); } I'd like to precisly specify the valid ranges of certain inputs - for example a A > B, C => 1 or str_d.length() > 0. Given that some of my functions have quite a lot of arguments which must be validated I can end up writing a lot of boiler-plate just to validate the pre-conditions. I'm writing a library which is