Pointers

From Adam Colton
Jump to navigation Jump to search

Or how I think we won't have them.

No Nulls

See Nulls

A variable can be declared without being initialized, but the compiler will throw an error if it could be used without being initialized.

Mutability

See Mutability.

We don't need pointers to indicate mutability.

Smart Compiler

The compiler can be smart. A pointer is going to be 8 bytes. Plus it may put pressure on the GC. So if the variable is much larger than that (say >16B), we use a pointer. Otherwise, pass by value. If the value is by reference, just copy over the old one when the call returns.