I don't think it is supported out of the box, but you can achieve that with
a macro.
julia> macro as(Typ, names...)
res = quote end
for n in names
push!(res.args, Expr(:(::), n, Typ))
end
res
end
julia> type Foo
@as Uint8 a b c
end
julia> f = Foo(1, 2, 3)
Foo(0x01,0x02,0x03)
julia> f.a
0x01
On Sunday, July 20, 2014 8:19:35 PM UTC+2, Noah Brenowitz wrote:
>
> in C it is possible to use statements like
> double a, b, c, d, e, f, g ;
>
> rather than
>
> double a;
> double b;
> ...
> double g;
>
> I frequently find the former notation more convenient than the latter, is
> there anyway to replicate it in Julia? Specifically, I want to avoid typing
> something like this.
>
>
> type Config
>
> a::Float64
> b::Float64
> ...
> g::Float64
>
> end
>