On Mon, May 8, 2017 at 10:06 AM, Martin Schreiber <mse00...@gmail.com> wrote:
> On Monday 08 May 2017 14:11:28 Marcos Douglas B. Santos wrote:
>> On Mon, May 8, 2017 at 2:39 AM, Martin Schreiber <mse00...@gmail.com> wrote:
>> >> > One does not need to use "class", it can be removed. I thought that
>> >> > people comming from Free Pascal will like it. ;-)
>> >> You could be right, but I think they will like more if not exist
>> >> ambiguity.
>> >> :)
>> > Other opinions? Should "class" be removed?
>> Well, if ^TObj is the same as class and you will continue using this
>> syntax then, yes, I think class should be removed.
>> But maybe we should think more about it.
> In order to clarify the difference of "object" and "class":
> "object" can be allocated on stack or on heap.
> "class" is an object which always is allocated on heap -> it always must be
> instantiated by a call of a constructor by <classtype>.TheConstructor() and
> it must be destroyed by a call of a destructor by
> <instancepointer>.TheDestructor() and it has an implicit dereference for
> element access.
> objty = object
> f1: int32;
> f2: int32;
> constructor create();
> destructor destroy();
> pobjty = ^objty;
> TObj = class(objty)
> constructor objty.create();
> destructor objty.destroy();
> obj1: objty; //an instance on stack, needs no create() or destroy()
> obj2: ^objty; //on heap
> obj3: pobjty;
> obj4: TObj; //on heap
> obj1.f1:= 123; //no create() call necessary, no destroy() call necessary
> obj2:= objty.create();
> obj2^.f1:= 123; //note the '^' dereference
> obj3:= objty.create();
> obj3^.f1:= 123; //note the '^' dereference
> obj4:= TObj.create();
> obj4.f1:= 123; //no '^' dereference
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?
2. In this case:
obj2: ^objty; //on heap
Is it possible to remove the "^"?
I think this distinction exists because "class" exists, right?
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
What do you think?
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