-
Notifications
You must be signed in to change notification settings - Fork 6
Did you know?
FeepingCreature edited this page Sep 30, 2013
·
2 revisions
- Classes are always reference types and need to be allocated with
new
. That is,Class class;
will not result in a valid object. UseClass class = new Class;
. - Arrays are allocated with
new T[] length
, notnew T[length]
. - Chars are
"a"
, not'a'
. All single-character string literals convert to chars. -
new closure
will currently only allocate its immediate surroundings. When a two-layer context becomes invalid, the closure will crash when trying to access the outer context. -
0..-5
will not yield{0,-1,-2,-3,-4}
. It will, in fact, yield{}
. This becomes easier to remember once you know thatfor auto v <- a..b
is equivalent tofor (auto v = a; v < b; v++)
. - When passing a Neat function to a C function as a callback, you must declare the Neat function as
extern(C)
! This is not (yet) enforced in the compiler, but you will get subtle crashing bugs if you don't. - The "reassign" function attribute causes the return value to be assigned to the first parameter, if it's not used otherwise. That is: if
reassign int foo(int i);
thenfoo(a);
is the same asa = foo(a);
. Look for examples instd.string
.