==== NEWOB ====
----
Replaces a given object with a new copy
----
^ __Input Stack__ ^ ^ __Output Stack__ ^
| **O** | **→** | **Ocopy** |
| //Level 1// | //→// | //Level 1// |
{{page>manual:chapter6:aux:legend&nofooter&noeditbtn&inline}}
| **Keyword type** | [[manual:chapter5:basics#commands|Command]] ||
| **Parallel list processing capabilities** | [[manual:chapter5:listproc#group-9quirky-commands|Group 9]] | //Quirky commands// |
| **Affected by flags** | //None// ||
----
The ''NEWOB'' command replaces an object on the stack with a new copy of itself.\\
\\
The command may seem pointless, but it solves a very specific problem: when an object originated from a larger composite object is extracted and put on the stack it contains a reference to the parent object; even if the parent object is ''[[manual:chapter6:stack:cmd_drop|DROP]]''ped from the stack it keeps on living in the RAM, occupying precious resources.\\
\\
A copy of the extracted object created by ''NEWOB'' breaks this link and allows the ''[[manual:chapter6:system:cmd_garbage|GARBAGE]]'' collection to recover the memory associated with the larger object once it is not needed anymore.
----
''NEWOB'' is fully equivalent to its **userRPL** counterpart.
----
**__Input__**
4:
3:
2:
1:{ 'LN(X)' 8888. [[ 1 2 3 ] [ 4 5 6 ]]…
…………………………………………………………………………………………………………
3 GET { 2 3 } GET NEWOB
\\
**__Output__**
4:
3:
2:
1: 6
…………………………………………………………………………………………………………
----
{{page>manual:chapter6:system&nofooter&noeditbtn&inline}}