Skip to content

Latest commit

 

History

History
64 lines (54 loc) · 1.77 KB

djinni.md

File metadata and controls

64 lines (54 loc) · 1.77 KB

Interfaces: like abstract base classes

interfaceName = interface +j +o {
    const constantA: i32 = 10;

    methodA(argumentA: i32): returnType;
    methodB();

    static staticMethod(): returnType;
}
  • Create an interface in Java (+j) and Objective-C (+o), called by C++. Java and Obj-C implement the methods.
interfaceName = interface +c {
    const constantA: i32 = 10;

    methodA(argumentA: i32): returnType;
    methodB();
    const methodC(): returnType;

    static staticMethod(): returnType;
}
  • Create an interface in C++ (+c)), called by Java and Obj-C. C++ implement the methods.

Records: like structs

recordName = record {
    attributeA: typeA;
    attributeB: typeB;
    attributeC: string;
} deriving (eq, ord)
  • Create a record with equality comparison (eq) and ordering comparison (ord)

Enums: like scoped enums

enumName = enum {
    optionA;
    optionB;
    optionC;
}

Data types:

Data Type Syntax C++ Java Obj-C
Boolean bool bool boolean BOOL
Primitives i8,i16,i32,i64,f32,f64
Strings string std::string String NSString
Binary binary std::vector<uint8_t> byte[] NSData
Date date chrono::system_clock::time_point Date NSDate
List list<type> std::vector ArrayList NSArray
Set set<type> std::unordered_set HashSet NSSet
Map map<typeA, typeB> std::unordered_map<K,V> HashMap NSDictionary
Optionals optional<typeA> std::experimental::optional object / boxed primitive reference object / NSNumber strong reference


Copyright © 2017 Alex Choi