dangerous. My goal is to control that power without extinguishing it,
so they become powerful with more clarity, and without the danger.
dangerous. My goal is to control that power without extinguishing it,
so they become powerful with more clarity, and without the danger.
to an actual object, or a 'nil' (or 'NULL') pointer, which isn't an
object and cannot be dereferenced safely. This provides power (it
enables simple finite linked lists) and danger (it is too easy to try
to an actual object, or a 'nil' (or 'NULL') pointer, which isn't an
object and cannot be dereferenced safely. This provides power (it
enables simple finite linked lists) and danger (it is too easy to try
As well as allowing `nil`, it is sometimes useful to allow other
non-pointer values to be stored in a pointer object. The Linux kernel
As well as allowing `nil`, it is sometimes useful to allow other
non-pointer values to be stored in a pointer object. The Linux kernel
In the first case, small integers (normally negative) can be stored in
a pointer variable. These are used as error codes. As the first page
of virtual memory and also the last page are not mapped, any pointer
In the first case, small integers (normally negative) can be stored in
a pointer variable. These are used as error codes. As the first page
of virtual memory and also the last page are not mapped, any pointer
Linux kernel uses these in hashtables that support lockless lookups
and movement of entries between chains. The loaded value is treated
like a `nil` pointer, but records which hash chain has come to an
Linux kernel uses these in hashtables that support lockless lookups
and movement of entries between chains. The loaded value is treated
like a `nil` pointer, but records which hash chain has come to an
of indicating a different interpretation of the whole pointer, the
least significant bit can be treated as a separate value that is
stored in the pointer - to optimize space usage. A particular use for
of indicating a different interpretation of the whole pointer, the
least significant bit can be treated as a separate value that is
stored in the pointer - to optimize space usage. A particular use for
this natively by allowing a field on a structure to be identified as
reference counter, but it will allow other options as well.
this natively by allowing a field on a structure to be identified as
reference counter, but it will allow other options as well.
This will probably be determined dynamically from code analysis,
though in some cases such as function parameters and returns, it must
be declared. An owned reference is one that holds a reference count
This will probably be determined dynamically from code analysis,
though in some cases such as function parameters and returns, it must
be declared. An owned reference is one that holds a reference count
primary, so both (or all) possible primaries must be preserved.
The "Scope" of the borrowed reference that the owned reference must be
primary, so both (or all) possible primaries must be preserved.
The "Scope" of the borrowed reference that the owned reference must be
-preserved for will often a a lexical scope, but may not always be. I
-imaging that the language may at some stage be able describe other
+preserved for will often be a lexical scope, but may not always be. I
+imagine that the language may at some stage be able describe other
temporal relationships between different objects. In that case, the
borrowed reference must have a life time contained within the
guaranteed lifetime of the matching borrowed pointer.
I should say that "Garbage collection" will be an option, just not the
temporal relationships between different objects. In that case, the
borrowed reference must have a life time contained within the
guaranteed lifetime of the matching borrowed pointer.
I should say that "Garbage collection" will be an option, just not the
references that need to be checked. Maybe collectable pointers
reserve the lsb for mark, prior to sweep.
compiler would extract a description of places that gc refs can live,
references that need to be checked. Maybe collectable pointers
reserve the lsb for mark, prior to sweep.
compiler would extract a description of places that gc refs can live,