Path: news.daimi.aau.dk!news.uni-c.dk!sunic!uunet!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!gatech!gt-news!cc.gatech.edu!forge!mcgraw From: mcgraw@cc.gatech.edu (Lee McGraw) Newsgroups: comp.lang.beta Subject: Re: what is a pattern? Date: 20 Sep 1994 20:37:14 GMT Organization: College of Computing, Georgia Tech Lines: 52 Distribution: world Message-ID: <35nh5q$81f@solaria.cc.gatech.edu> References: <351r8g$rkv@belfort.daimi.aau.dk> Reply-To: mcgraw@cc.gatech.edu NNTP-Posting-Host: forge.cc.gatech.edu NNTP-Posting-User: mcgraw Ole Villumsen writes that he hoped someone else would jump in to this discussion, so I figure why not me? A pattern in BETA describes a class. It is just like a class declaration in C++, Eiffel or Sather, *except* that in BETA objects are not always passive. This is the innovation. In BETA, an object can have an action associated with it. In most OO languages, an object is just a passive object, in essence a record with type-bound procedures associated with its type. E.g. if A is type/class T then A.p implies p is a procedure "bound" to objects of type T and acting on objects of that type (in this case A). BETA can have passive objects like this but also objects of a more active kind. For example, Multiply : (# a, b : @integer; enter (a, b) exit a * b #) m : ^Multiply; { m is a reference to multiply objects } &Multiply[] -> m[]; { m contains a multiply object } (2, 3) -> m -> putInt { cause the multiply ACTION of m to occur } { and the i/o action of putInt to be called } This is a really artificial example but it illustrates the special quality of a BETA pattern and why a pattern can replace, in various contexts, procedures, functions, blocks, and of course the class declaration. One construct instead of four. The following is a BETA form for Multiply in conventional OO languages, Object : (# a : @integer; Mult : (# b : @integer enter b exit a*b #) #) { in this case, Object describes passive record-like objects } x : ^Object &Object[] -> x[]; 2 -> x.a; 3 -> &x.Mult ->x.a { notice you had to create a new x.Mult object before invoking its action } { the "object" is an activation record } I hope this is clear and doesn't just add to the confusion. --- -------------------------------------------------------- | | | | | It's always somethin' | |-Lee McGraw | Rosanne Rosanadana | | (mcgraw@cc.gatech.edu) | | | | | --------------------------------------------------------