Skip to content
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. Use Class class = new Class;.
  • Arrays are allocated with new T[] length, not new 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 that for auto v <- a..b is equivalent to for (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); then foo(a); is the same as a = foo(a);. Look for examples in std.string.
Clone this wiki locally