Announcement

Collapse
No announcement yet.

Simple object autodestruct functionality

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Edwin Knoppert
    replied
    This technique could be very handy if you wish to provide a common module (include) to others.
    It can prevent manual cleaning code in your pbmain() for example.

    The functions in that module could also be prepared to verify it's properly intitialized and evt. take action.

    Since the variant will result in a callback call on clearing, you'll be able to take appropriate action.

    I would not use it on severe use like in a windowprocedure, that's to much overhead imo.

    However for neat and clean simple include stuff it's very handy.

    Leave a comment:


  • Michael Mattias
    replied
    I'll acknowledge your linked page contains things I don't begin to understand; however, I am totally inured to the concept that the programmer is responsible for cleaning up after himself....

    ...and that the best way to do this is to always "obtain" (create, get, open ) and "release" (close, destroy, free) in the same procedure...making scope moot.

    Leave a comment:


  • Edwin Knoppert
    replied
    >What am I missing here?

    Brains?

    Leave a comment:


  • Michael Mattias
    replied
    DeleteObject? CloseHandle? [OBJECT] SET/LET objectvar=NOTHING?

    What am I missing here?

    Besides, "Scope" is a 'compile time' attribute/thing only and there is nothing one can do about it at runtime.
    Last edited by Michael Mattias; 26 Nov 2007, 09:44 AM.

    Leave a comment:


  • Edwin Knoppert
    started a topic Simple object autodestruct functionality

    Simple object autodestruct functionality

    "When a variable get's out of scope and if it contains some kind of handle it would be nice if we had a way to destroy the handle automatically"

    See:

    http://www.hellobasic.com/cgi-bin/fo...num=1195328685
Working...
X