I am creating scripting language. When I allocate thing ,it's allocate the thing and returns the address and then I do whatever with it and then delete it. I can't control the variables in it like creating struct in my lang (Struct with pointer and bool to check if pointer is pointing to valid data) and etc because it'll make my lang slower and bigger in the RAM.
For example: (My scripting language is easily to understood. I doubt you'll not understand this ,but I'll put some comments in it anyway)
MyStruct = { //Function. For create object with it use 'new' before it.
TestAliveVar=0
}
Func = { //I'll explain what exactly this function does every place it runs.
if (!exists(arg0)) //C++: ???
exit;
arg0.TestAliveVar=1
println "Still alive!";
}
var MyVar=new MyStruct(); //Returns address of the new object in the heap
//and runs on it the `MyStruct` function.
Func(MyVar); //Sets his 'TestAliveVar' to 1
//and prints 'Still Alive!' with new line
delete(MyVar); //C++: free(MyVar);
Func(MyVar); //Does nothing
The question is how to create the function exists
you saw in this code.
BTW I can run C++ codes in this lang.