Doubly-linked list/Definition: Difference between revisions

Content added Content deleted
Line 1,502: Line 1,502:


We can use ? as print.
We can use ? as print.

There is no garbage collector for pointers for groups, except the reference counter. We can use groups without pointers and we place them in containers, and use indexes or keys for those containers as pointers. Using groups with no pointers make each group unique, so there is no circular dependency between two groups. Containers have garbage collector.

Using pointers inside groups make harder to program.

Groups are two kinds in M2000. The named group (or static in a way) and the float group (unnamed). Pointers for groups are also two types, internal, but we handle it as one type. If we get a pointer to a named group, actually we get a weak reference. If this named grouped erased then weak pointer can't work, we get error. If we get a pointer from an expression we get a real pointer (with counting reference). To get a real pointer from a named group is not possible. We can use A->(namedGroup) to get a pointer of a copy of namedGroup. Then we can use namedGroup=Group(A) to merge a copy of A to namedGroup (same members get new values, new members added, unique members of namedGroup stay as is).



<lang M2000 Interpreter>
<lang M2000 Interpreter>
Line 1,541: Line 1,548:
.Tail->Null
.Tail->Null
} Else {
} Else {
.Tail<=n=>succ
.Tail<=n=>succ
.Tail=>pred=n=>pred
.Tail=>pred=n=>pred
n=>pred->Null
n=>pred->Null
}
}
for n {
for n {
.succ->Null
.succ->Null
.pred->Null
.pred->Null
}
}
=n
=n