From: <cod...@go...> - 2008-12-08 19:51:19
|
Status: New Owner: james.c...@usma.edu Labels: Type-Defect Priority-Medium New issue 9 by james.c...@usma.edu: "super" does not chain properly on Mac OS 10.5.5 http://code.google.com/p/hoc/issues/detail?id=9 Steps to reproduce the problem: 1. Define a class with a method that calls super 2. Subclass that class 3. Call the method that calls super on the subclass - What I expect is that call to super should dispatch to the implementation from the class above the class implementing that version of the method. - What I see is that the call goes to the superclass of the implementation of the object, triggering an infinite loop of calls to that same implementation until the stack overflows. The following code exhibits the behavior I am seeing: {-# LANGUAGE TemplateHaskell, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, DeriveDataTypeable #-} module Main where import HOC import Foundation (NSObject, NSObjectClass, alloc, init) import Prelude hiding (init) $(declareSelector "sayHi" [t| IO () |]) $(declareClass "Hello" "NSObject") $(exportClass "Hello" "hello_" [ InstanceMethod 'sayHi ]) hello_sayHi self = do putStrLn "hi!" $(declareClass "Howdy" "Hello") $(exportClass "Howdy" "howdy_" [ InstanceMethod 'sayHi ]) howdy_sayHi self = do putStrLn "About to say hi:" super self # sayHi $(declareClass "Antisocial" "Howdy") $(exportClass "Antisocial" "" []) instance Has_sayHi (Hello a) main = do initializeClass_Hello initializeClass_Howdy initializeClass_Antisocial me <- _Antisocial # alloc >>= init me # sayHi -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings |