Types are central to Julia programming, but the built-in `type` and 
`immutable` definitions can be cumbersome to write. QuickTypes.jl 
<https://github.com/cstjean/QuickTypes.jl> provides two alternative macros, 
*@qtype* and *@qimmutable, *with a more convenient syntax:

Pkg.add("QuickTypes")   # to install
using QuickTypes

@qtype Wall(width, height)

# Optional and keyword-arguments
@qtype Cat(name, age::Int, nlegs=4; species="Siamese")

# Parametric type
@qtype Pack{T}(animals::Vector{T})

# Inheritance
abstract Tree
@qtype Maple(qty_syrup::Float64) <: Tree

# Immutables work the same way
@qimmutable SquaredNumber(x2::Number)

Reply via email to