Short overview on D
anonymous via Digitalmars-d
digitalmars-d at puremagic.com
Sun Aug 3 01:11:50 PDT 2014
-- Functions --
> Ref implies the type is a reference type, i.e. changes inside
> the functions will change the variable outside the function. in
> means immutable out is an alias for ref(preferably used for
> parameters)
`ref` doesn't "imply" a reference, it "declares" or "states" or
something.
`in` doesn't mean immutable, it means scope const.
`out` is similar to `ref`, but it's not an alias. Unlike `ref`,
an out "parameter is initialized upon function entry with the
default value for its type".
-- Operator Overloading --
The wording suggests that the list of operators is supposed to be
exhaustive. It's not.
> unitary
unary
-- Templates --
> Templates are D's response to Java generics and C++ templates.
At least put C++ first if you have to include Java ;)
> Basically templates are metaclasses that take types as
> parameters.
Template parameters are not restricted to types. They can also be
values or symbols.
> alias List!int.ArrayList IntList;
Maybe use the more fashionable assignment syntax:
alias IntList = List!int.ArrayList;
-- Arrays --
> a[x..y] is an array containing a[x] all the way to a[y]
To avoid confusion: all the way up to, but not including, a[y].
More information about the Digitalmars-d
mailing list