Prototype problems

Previous topic - Next topic

bigsofty

PROTOTYPE is one of those commands I've barley used, I always seem to run into problems with trying to get them to do things that they dont want to do.  :S

This is probably another example but here goes...

As you can see by this code, I am trying to prototype a function within a type to another function within a type (I need the function to have access to .self) but that's a no-go with the compiler. Is it possible at all?

Here is my simple test code...

Code (glbasic) Select
PROTOTYPE update_proto:

TYPE tt

x#

update AS update_proto

FUNCTION SetUp:
// self.update = self.myupdate
ENDFUNCTION

FUNCTION myupdate:
self.x# = 1
ENDFUNCTION

ENDTYPE

GLOBAL t AS tt

t.SetUp()

t.update = t.myupdate

t.update()


Anyone see a way what I am doing wrong here?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

MrTAToad

PROTOTYPE can only be used with standard functions unfortunately - it wont (currently) work with the prototyped function being in an extended type.

bigsofty

Bummer! I kind of thought that may be the problem but I just hoped my syntax was wrong.

Ah well, thanks for the heads up Mr T.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)