[M3devel] something wrong with ISTYPE ...

mika at async.caltech.edu mika at async.caltech.edu
Sun Jan 19 10:41:39 CET 2014


Hi m3devel,

There is definitely something wrong with ISTYPE.  The problem I reported earlier goes away if I change the code like so:

(416)truffles:~/t/btc/hparse/AMD64_LINUX>diff -c BDDSchemeStubs.m3.old BDDSchemeStubs.m3
*** BDDSchemeStubs.m3.old       2014-01-19 01:13:33.000000000 -0800
--- BDDSchemeStubs.m3   2014-01-19 01:36:52.000000000 -0800
***************
*** 613,622 ****
  PROCEDURE ToModula_BDD_T(x : SchemeObject.T) : (BDD.T) RAISES { Scheme.E } = 
    BEGIN
      IF x # NIL AND ISTYPE(x, REF BDD.T) THEN RETURN NARROW(x,REF BDD.T)^ END; 
!     IF NOT ISTYPE(x,BDD.T) THEN
        RAISE Scheme.E("Not of type BDD.T : " & SchemeUtils.Stringify(x))
!     END;
!     RETURN x
    END ToModula_BDD_T;
  
  
--- 613,624 ----
  PROCEDURE ToModula_BDD_T(x : SchemeObject.T) : (BDD.T) RAISES { Scheme.E } = 
    BEGIN
      IF x # NIL AND ISTYPE(x, REF BDD.T) THEN RETURN NARROW(x,REF BDD.T)^ END; 
!     TYPECASE x OF
!       BDD.T(xx) => RETURN xx
!     ELSE
        RAISE Scheme.E("Not of type BDD.T : " & SchemeUtils.Stringify(x))
!     END
! 
    END ToModula_BDD_T;

This shouldn't be possible... it's the same object as before, with the
same return type.  I don't get an exception (I shouldn't either)---the
return just behaves normally and the program works.  Why doesn't it work
with ISTYPE but only with TYPECASE?

BTW, this is an old bug.  Same behavior with ancient PM3.  Where to look
in the code?

    Mika



More information about the M3devel mailing list