Experimental Solidity
Daniel Kirchner (ekpyron)
The Current State of Things
Path A
Path B
Path A
Experimental Solidity
Experimental Solidity
Design Goals
Simple Core Language
Features and Types in Standard Library
Language User View
Implementor &
Library Author
View
Syntax Surprises: Postfix types
function double(x:uint256) -> uint256 {� let doubleX:uint256 = x * x;� return doubleX;�}
// Complex type expressions become parsable.
let f:(uint256,bytes32|bool)->int;
Syntax Surprises: Type Classes & Quantifiers
forall type:Multipliable.
function double(x:type) -> type {� let doubleX:type = x * x;� return doubleX;�}
Syntax Surprises: Type Inference
forall type:Multipliable.
function double(x:type) -> type {� let doubleX = x * x;� return doubleX;�}
Syntax Surprises: Type Inference
function double(x) -> _ {� let doubleX = x * x;� return doubleX;�}
Every expression (including functions) has a unique most general type (principal type) that can be inferred by the compiler.
class self:Multipliable {� function mul(x:self, y:self) -> self;�}
type uint256 = word;
instantiation uint256:Multipliable {
function mul(x:uint256, y:uint256) -> uint256 {
let x_rep:word = uint256.rep(x);
let y_rep:word = uint256.rep(y);
let r:word;
assembly { r := mul(x_rep, y_rep) }
return uint256.abs(r);
}
}
class self:Multipliable {� function mul(x:self, y:self) -> self;�}
type uint256 = word;
instantiation uint256:Multipliable {
function mul(x, y) -> _ {
let x_rep = uint256.rep(x);
let y_rep = uint256.rep(y);
let r;
assembly { r := mul(x_rep, y_rep) }
return uint256.abs(r);
}
}
trait Multipliable {� function mul(x:self, y:self) returns(z:self);�}
type uint256 is word;
implement Multipliable for uint256 {
function mul(x, y) returns(_) {
let x_rep = uint256.unwrap(x);
let y_rep = uint256.unwrap(y);
let r;
assembly { r := mul(x_rep, y_rep) }
return uint256.wrap(r);
}
}
How far can this be taken?
type memory(a) = word;
How far can this be taken?
Syntax Sugar
-> Decision based on community feedback
A Guess of a Timeline
A Guess of a Timeline
The Future of Solidity Feature Development
The Future of Solidity Feature Development
-> The core language stabilizes
-> Community demand for features can still be met as collective effort of the community in Standard Library Development, Auditing and Verification.
The Future of Solidity Feature Development
Thursday,
Nov 16, 2023
Istanbul, Türkiye