Rogue is a secure, flexible and purpose built programming language thats capable of encoding ownership and scarcity of an asset. Rogue has been designed to support a wide range of economic and financial activities of a user on Dijets Blockchain by supporting fundamental conservation properties, not only for built-in currencies, but also for programmer defined assets. In the case of solidity the conservation properties mainly extend to only the built in currency - Ether. This was one of the main reasons for why we chose to build our own language and this choice unlocked a whole new subclass of added functionalities which were not possible before. To begin with, smart contracts provide customizable logic for sending, receiving, storing, and apportioning digital funds that cannot be arbitrarily created, lost, or destroyed.
Furthermore in Rogue the internal balance of an account or , the monetary value inherent in a contract for future payment, or an escrow contract all represent assets that must be conserved in the same ways as any conventional currency would. Thus, smart contracts must be able to implement new assets with expected conservation properties and appropriately control the exchange of one asset for another.
Rogue can represent money using user-defined linear resource types. And although Rogue has ordinary types e.g. integers and addresses that can be copied, but the resources on the other hand can only be moved and not copied. Exactly how a real world currency operates. Linearity prevents “double spending” by moving a resource twice (e.g., into two different callees) and forces a procedure to move all of its resources, avoiding accidental loss.
It's also fully understandable to question the rationale behind Dijets opting for a brand new language rather than sticking with the usual choices. Languages like Solidity are also purpose built for blockchains. So why didn't we at Dijets just go with that. -bottom-10
We explained above the lack of fundamental conservation properties in languages like solidity. To understand its repercussions and importance and why that became the cornerstone for our development of a new language, lets take a simple example of a small contract which demonstrates the advantages of Rogue over Solidity and other contract programming languages where significant problems have already occurred in the past.
The contract above implements a relatively simple savings bank contract with the following requirements: • A customer should be able to deposit money worth N via the deposit procedure and subsequently extract money worth N via the withdraw procedure. • No customer should be able to withdraw money deposited by another customer
A smart contract like this implements bidirectional exchanges of the language’s native currency for a bank credit currency also defined in the contract. Notice that in Solidity's case (contract code above) both native and custom currencies are nowhere to be found except being represented indirectly via maps of identities to integers.
Let's take a look at the same contract and how it can be written in Rogue but without the need to represent currencies indirectly and or via maps of their identities to integers. Currency in Rogue, is represented exactly as it ought to - Currency.
Rogue represents money/currency using user-defined linear resource types. Rogues has the ordinary types like integers and addresses too and those can be copied, but resources in Rogue can't be copied. They can only be moved or destroyed or go out of scope of a variable to completely cease to exist. Linearity prevents “double spending” by moving a resource twice (e.g., into two different callees) and forces a well-typed procedure to move all of its resources, avoiding accidental loss.
In this guide you will get to grips with the fundamentals of Rogue and methods. Whilst every effort has been made to provide up-to-date and versioned information, please note that Rogue is still a new language and some major changes in the near future are to be expected.
Rogue is a new high level, secure and next generation language intended for smart contracts development. Rogue has been built specifically for Dijets and provides the foundation for the implementation of Dijets Blockchain principles. It is an executable bytecode language used to implement custom transactions and 'Methods' (type of smart contracts) in Dijets. The key feature of Rogue is the ability to define custom resource types (an iterative take on the semantics of the Linear Logic). The quickest way to understand a resource is to consider it as something that can never be copied or implicitly discarded, only moved between different program storage locations.