Intercept instanceof

R

Robert

VK said:
The posted code is still not sufficient to understand the model,
because IMO it is not functional:
validate(arguments, [IDragListener]);
cannot tell you anything useful about dragDropEnd, dragEnter etc.
because these methods have nothing to do with IDragListener so this
constructor has no idea about them:

Yes it can. The instance is right there in the arguments to test.

If you don't understand it, that's fine. But what is the use of coming
up with an example where you are creating an instance of some interface
class. Which of course defeats the whole purpose of everything.
 
V

VK

VK said:
The posted code is still not sufficient to understand the model,
because IMO it is not functional:
validate(arguments, [IDragListener]);
cannot tell you anything useful about dragDropEnd, dragEnter etc.
because these methods have nothing to do with IDragListener so this
constructor has no idea about them:

Yes it can. The instance is right there in the arguments to test.

You mean in the "arguments" argument? But against what are you
checking the instance? Based on the second argument [IDragListener] -
against the IDragListener constructor and this is pointless for the
reason I explained. If it still works for you as intended then
[IDragListener] argument is a bogus and a vital part of the logic is
omitted on posting.
If you don't understand it, that's fine.

Of course - as it was explained by some I sometimes do not understand
myself :) What is surprising though that local experts are looking at
object instance whose prototype is checked against constructor and
they seem "understand" it based on their silence. Oh well, stupid VK.
But what is the use of coming
up with an example where you are creating an instance of some interface
class.

I do? Where? The sample I posted very roughly equal to Java's

class IDragListener implements MouseListener {
void dragDropEnd(Event evt) {
// your code here
}
// etc.
}

abstract interface MouseListener {
static dragDropEnd(Event evt) {
}
// etc.
}
Which of course defeats the whole purpose of everything.

"the whole purpose of everything" in class-inheritance interpretation
is a way too cloudy matter :) A block-schema of what is your final
aim would help better.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,812
Messages
2,569,694
Members
45,478
Latest member
dontilydondon

Latest Threads

Top