Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Oberon subtyping (was: JWlinkD updated) (Developers)

posted by Rugxulo(R) Homepage, Usono, 20.02.2012, 20:14

> I made a small update to
> , which has the following changes:
> After these fixes your sample did run, linked with jwlink.

Cool, thanks. Yes, it seems to work.

BTW, here's another silly example just to demonstrate the subtyping of Oberon:

MODULE blah;
IMPORT O := Out;

     Tchar   = RECORD (object) c: CHAR END;
     Tstring = RECORD (object) str: ARRAY 255 OF CHAR END;
     Tinteger= RECORD (object) i: LONGINT END;

VAR name: Tstring; number: Tinteger; grade: Tchar;

PROCEDURE write(VAR o: object);
  IF o IS Tchar THEN O.Char(27X); O.Char(o(Tchar).c); O.Char(27X)
  ELSIF o IS Tstring THEN O.Char(22X); O.String(o(Tstring).str); O.Char(22X);
  ELSIF o IS Tinteger THEN O.Int(o(Tinteger).i,1)
  ELSE O.Ln; O.String("dunno")
END write;

BEGIN (* blah *)
  grade.c := "B"; number.i := 5150H; COPY("dosuser",name.str);

  write(name); write(number); write(grade);
END blah.


Complete thread:

Back to the forum
Board view  Mix view
15317 Postings in 1383 Threads, 254 registered users, 8 users online (0 registered, 8 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum