Skip to content

[IoVM] Block isKindOf #24

Closed
superbobry opened this Issue Apr 3, 2010 · 2 comments

3 participants

@superbobry

I'm not quite sure what's happening here, but Block instances handle isKindOf incorrectly. Example:
Io> Block isKindOf(Object)
==> true
Io> Lobby getSlot("forward") type
==> Block
Io> Lobby getSlot("forward") isKindOf(Object)

  Exception: Object does not respond to 'self'
  ---------
  Object self                          A2_Object.io 380
  Block ancestors                      A2_Object.io 387
  Block isKindOf                       Command Line 1
@kinda
kinda commented May 24, 2010

I think the issue comes from the "ancestors" method which shouldn't activate x and self.

Instead of:

ancestors := method(a,
  if(a, if(a detect(x, x isIdenticalTo(self)), return a), a = List clone)
  a append(self)
  self protos foreach(ancestors(a))
  a
)

We should have something like:

ancestors := method(a,
  if(a, if(a detect(x, getSlot("x") isIdenticalTo(getSlot("self"))), return a), a = List clone)
  a append(getSlot("self"))
  self protos foreach(ancestors(a))
  a
)
@stevedekorte
Owner

Fixed - thanks for report and suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.