Chaosforge Forum

  • October 04, 2024, 08:48
  • Welcome, Guest
Please login or register.



Login with username, password and session length
Pages: [1] 2  All

Author Topic: "Destroy" method override in Vnode?..  (Read 28748 times)

Igor Savin

  • Elder Chaos Guard
  • Second Lieutenant
  • *
  • *
  • Offline Offline
  • Posts: 180
    • View Profile
"Destroy" method override in Vnode?..
« on: December 27, 2007, 04:35 »

///
       destructor  Destroy; override;
///

...even though it consecutively inherits from TVClass and TVObject, neither of which has defined destructor.

Why?
Logged

Kornel Kisielewicz

  • God Hand
  • Apostle
  • *
  • *
  • Offline Offline
  • Posts: 4576
    • View Profile
    • http://chaosforge.org/
Re: "Destroy" method override in Vnode?..
« Reply #1 on: December 27, 2007, 11:31 »

TObject, the base class of all objects in FreePascal has a Destroy method (note that you can call X.Destroy on ANY object in FreePascal, even if it doesn;t define it's own destructor). The usage of it is for data structures -- so they can hold any sets of objects, and be sure that if they call Object.Destroy, then all data will be properly disposed of.

P.S. What's up lately? :)
Logged
at your service,
Kornel Kisielewicz

Igor Savin

  • Elder Chaos Guard
  • Second Lieutenant
  • *
  • *
  • Offline Offline
  • Posts: 180
    • View Profile
Re: "Destroy" method override in Vnode?..
« Reply #2 on: December 27, 2007, 12:59 »

Aha, I see it now. God damn the FreePascal documentation for omitting heaps of useful information and being an overall mess.

A second question: I somehow managed to get program crashing with calling the TNode.Free procedure, for which I cannot find any description and which doesn't look like a simple Destructor. What is is, where it comes from and what it really does? Is it safe to replace it with merely a TNode.Destroy (which doesn't produce any crashes) or there's a catch?

Awww... lots of stuff. I'm almost ready taking on the Universe with limited public release of "HoaH", which now mostly requires some polish (functionality-wise it only lacks some easier-to-implement stuff which isn't really necessary to prove geniality of the concept).

In regards to Life (TM): I've got my first serious work (software tester at one of the largest Lithuanian IT companies), I have an uncoming session on me, and this Spring I'm getting engaged (-:. Life's bright, life's taxing. Life is good.


p. s. My avatar seems outdated in regards to yours :).
Logged

Kornel Kisielewicz

  • God Hand
  • Apostle
  • *
  • *
  • Offline Offline
  • Posts: 4576
    • View Profile
    • http://chaosforge.org/
Re: "Destroy" method override in Vnode?..
« Reply #3 on: December 27, 2007, 13:54 »

A good programming practice is to never use Free or Destroy at all, but to always use FreeAndNil(Object) -- from SysUtils. It's the safest way (if the object is already nil, then nothing happens).

As to real life -- OMG! O.o

Logged
at your service,
Kornel Kisielewicz

Igor Savin

  • Elder Chaos Guard
  • Second Lieutenant
  • *
  • *
  • Offline Offline
  • Posts: 180
    • View Profile
Re: "Destroy" method override in Vnode?..
« Reply #4 on: December 29, 2007, 05:00 »

Kornel, shouldn't TNode.Detach include Parent:=nil?..
Logged

Kornel Kisielewicz

  • God Hand
  • Apostle
  • *
  • *
  • Offline Offline
  • Posts: 4576
    • View Profile
    • http://chaosforge.org/
Re: "Destroy" method override in Vnode?..
« Reply #5 on: December 29, 2007, 06:06 »

Sometimes after detaching we might still like to know the parent. And leaving it uncleared doesn't open too any mistakes anyway.
Logged
at your service,
Kornel Kisielewicz

Igor Savin

  • Elder Chaos Guard
  • Second Lieutenant
  • *
  • *
  • Offline Offline
  • Posts: 180
    • View Profile
Re: "Destroy" method override in Vnode?..
« Reply #6 on: January 01, 2008, 13:09 »

After the major exam (World Literature on Jan. 7) is over, I'm planning on attempting a new iteration of functionality adaptation from Valkyrie to Colossus (Valkyrion Stage 2). I wonder if you have any interest in whatever expansions to Valkyrie functionality might be made from Colossus, and what would be the best way of describing and proposing them to V. - most probably SVN commits would be an inappropriate way.
Logged

Kornel Kisielewicz

  • God Hand
  • Apostle
  • *
  • *
  • Offline Offline
  • Posts: 4576
    • View Profile
    • http://chaosforge.org/
Re: "Destroy" method override in Vnode?..
« Reply #7 on: January 01, 2008, 13:34 »

Depends on what you want to expand -- it may be already planned. Just hint me hwat you are thinking about :)
Logged
at your service,
Kornel Kisielewicz

Igor Savin

  • Elder Chaos Guard
  • Second Lieutenant
  • *
  • *
  • Offline Offline
  • Posts: 180
    • View Profile
Re: "Destroy" method override in Vnode?..
« Reply #8 on: January 04, 2008, 15:13 »

I've been primarily thinking about revamping menus - I recall those used in Berserk! being a hardcoded non-reusable nightmare.

AFAIR, you are using LGPL for Valkyrie? If I'm going to distribute software which uses modified parts of it, what should I include in my sources (besides the typical kudos) - complete LGPL license in addition to the one I use (GPL3)?
Logged

Kornel Kisielewicz

  • God Hand
  • Apostle
  • *
  • *
  • Offline Offline
  • Posts: 4576
    • View Profile
    • http://chaosforge.org/
Re: "Destroy" method override in Vnode?..
« Reply #9 on: January 04, 2008, 17:02 »

Umm, have you seen, vtextut.pas, and TTextMenu in it? Berserk! uses those too now. And as for general GUI stuff, I'm planning to do a proper and compete GUI system in Valkyrie for the use of especialy Sa^D^D... another project of mine :P

As for license, my friend, I give you the right to relicense it under what you want :P.
Logged
at your service,
Kornel Kisielewicz

Igor Savin

  • Elder Chaos Guard
  • Second Lieutenant
  • *
  • *
  • Offline Offline
  • Posts: 180
    • View Profile
Re: "Destroy" method override in Vnode?..
« Reply #10 on: January 05, 2008, 03:28 »

Yep, my Berserk! sources are rather outdated. I'll check the latest ones.

You mean ASCII-based GUI? When is the expected date of release (with half a year precision :-P)?

As for license, my friend, I give you the right to relicense it under what you want :P.

Wow, thanks. Does this include relicensing rights to whatever moment I finally start using complete Valkyrie, or only to current transitional stage?
Logged

Kornel Kisielewicz

  • God Hand
  • Apostle
  • *
  • *
  • Offline Offline
  • Posts: 4576
    • View Profile
    • http://chaosforge.org/
Re: "Destroy" method override in Vnode?..
« Reply #11 on: January 05, 2008, 08:42 »

with a half year precision? In half a year :P.

Seriously though -- I need a simple GUI to start working on S anyway. :P

Whenever you like. The FP version of Valkyrie I may release under a BSD license anyway.
Logged
at your service,
Kornel Kisielewicz

Igor Savin

  • Elder Chaos Guard
  • Second Lieutenant
  • *
  • *
  • Offline Offline
  • Posts: 180
    • View Profile
Re: "Destroy" method override in Vnode?..
« Reply #12 on: January 06, 2008, 12:32 »

Latest Berserk sources are beautiful :).

What does the "class function\procedure" mean?

Like
"class procedure Skill;"
in TBerserkCharGen (bruichar)
description?
Logged

Kornel Kisielewicz

  • God Hand
  • Apostle
  • *
  • *
  • Offline Offline
  • Posts: 4576
    • View Profile
    • http://chaosforge.org/
Re: "Destroy" method override in Vnode?..
« Reply #13 on: January 06, 2008, 12:44 »

a class procedure/function is not tied to the instance. That is -- you don't have to create such a object, you can call that function/procedure directly.
Logged
at your service,
Kornel Kisielewicz

Igor Savin

  • Elder Chaos Guard
  • Second Lieutenant
  • *
  • *
  • Offline Offline
  • Posts: 180
    • View Profile
Re: "Destroy" method override in Vnode?..
« Reply #14 on: January 06, 2008, 13:19 »

Looks like this time I'll migrate completely :).

You are using AnsiStrings everywhere (e. g. default Output.DrawString). Aren't those time\resource-wasting overkill?
Logged
Pages: [1] 2  All