I like @type and @immutable, but I would worry about using reserved keywords for a macro name. It might mess up other parsers (for syntax highlighting, indentation). `qtype` is serviceable for now. When/if `type` gets renamed in Julia, I will reconsider...
On Sunday, October 30, 2016 at 12:47:22 PM UTC-4, Stefan Karpinski wrote: > > The issue in question in case anyone is curious: > https://github.com/JuliaLang/julia/issues/19157. > > On Sunday, October 30, 2016, Stefan Karpinski <ste...@karpinski.org > <javascript:>> wrote: > >> That wasn't a PR, it was a "crazy idea" issue. Please stop spreading >> bogus news of change before anything has been decided, let alone happened. >> >> On Sunday, October 30, 2016, Scott Jones <<> wrote: >> >>> Maybe `@mutable` instead of `@qtype` or `@type`, to reflect Jeff's PR to >>> change the `type` keyword to `mutable`, making the naming consistent >>> >>> On Tuesday, October 25, 2016 at 11:00:13 AM UTC-4, Cedric St-Jean wrote: >>>> >>>> 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) >>>> >>>>