I know the benefits of OOP have been exagerrated, but there are times when it could come in handy. I was thinking of a 'simple' addition to PB that would be a pretty large step in supporting Objects. Consider:
Code: Select all
Structure alien
x.w
y.w
speed.b
Procedure Init() ; This is called when a new 'alien' type is
; created. A reserved name.
; initialization code goes here
EndProcedure
Procedure Default() ; A reserved procedure name. This procedure
; is automatically called whenever any of the
; variables are are referenced in this
; structure. It is global to all 'alien'
; types.
; default code goes here
EndProcedure
Procedure Destroy() ; Called when this type is destroyed
; Code goes here
EndProcedure
Procedure Explode(arg.l) ; A user-defined procedure which is auto-
; matically called if it is referenced by
; name like this:
; my.alien\Explode = #True
; (the value of #True is passed to
; Explode() )
EndProcedure
EndStructure
Code: Select all
AddPrivateProc my.alien, @Private ; Where @Private would point to
; a procedure for it's own static
; use.
Russell
***Commodore 64 - Over one million cycles per second, 16 vibrant colors, 3 incredible audio channels and 38,911 Basic Bytes Free! Who could ask for anything more?***