On Monday 08 May 2017 16:49:40 Marcos Douglas B. Santos wrote:
> Some questions:
> 1. In this case:
> obj1: objty;  //an instance on stack, needs no create() or destroy()
> if my object has create() or destroy() they will be executed automatically?
No. Call it "manually":
or use "ini", "fini" methods:
 objty = object
  method theinimethod() [ini];   //called after object initialization
  method thefinimethod() [fini]; //called before object finalization
"ini" and "fini" work for stack and heap.

> 2. In this case:
>  obj2: ^objty; //on heap
> Is it possible to remove the "^"?
> obj2.f1:= 123;
No, obj2 is a pointer.

> I think this distinction exists because "class" exists, right?

The other way around, "class" exists for convenience and where one needs the 
guarantee that the instance never is allocated on stack.

> If is possible to remove, well, this is +1 to remove class and mantain
> just object but without "^" in calls, but we can continue using in
> definition.
And how to access object elements if they are allocated on stack and not 
addressed via pointer?

"@obj1.f1" or "obj1↓.f1" or...?


Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
mseide-msegui-talk mailing list

Reply via email to