Jorg,
 If you are using $MyGreatObj in a loop or some situation where you are
reusing it you can also do:

For each ($MyGreatObj; $someDataStructure)

$MyGreatObj:=New Object

$myGreatObj:= <whatever I'm doing with it>

$someOtherObj.greatProp:=$MyGreatObj

End for each

Remember that unlike other reference items from the past (menus and lists)
when you create an object using $anything:=New Object its scope is a local
variable. So when the method that created it ends the variable is cleared
too UNLESS you assigned it to a non-local variable.

This made me curious so I just checked out how this works in the debugger:

C_OBJECT($myGreatObj)  //  $myGreatObj = null
$myGreatObj:=New object  // $myGreatObj = {}

CLEAR VARAIBLE($myGreatObj) // $myGreatObj = null


So we can say New object initializes the object as empty and CLEAR VARIABLE
sets it to null, which is equivalent to $myGreatObj:=null.

On Sun, Aug 11, 2019 at 1:03 AM Jörg Knebel via 4D_Tech <
[email protected]> wrote:

> Happy Sunday to all,
>
> Just wondering how would one clear/delete/vaporise a 4D object (Language):
>
> C_Object($MyGreatObject)
>
> $MyGreatObject:= New Object
> $MyGreatObject:=Get system info
>
> // playing around with the object
>
> Now I want to clear/vaporise the object before I go on, but not set all
> the properties to NULL
>
>
>
> Would the object have been created by ObjectTools I’d simply use
>
> OT Clear ($MyGreatObject).
>
>
> Any pointers anyone?
>
> Thanks
>
> Cheers
> Jörg
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************



-- 
Kirk Brooks
San Francisco, CA
=======================

What can be said, can be said clearly,
and what you can’t say, you should shut up about

*Wittgenstein and the Computer *
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to