Path: news.daimi.aau.dk!poe From: "Soren Brandt" Newsgroups: comp.lang.beta Subject: Re: Re-Two question about assignment Date: 15 Jun 1995 08:38:56 GMT Organization: DAIMI, Computer Science Dept. at Aarhus University Lines: 40 Approved: mailtonews@daimi.aau.dk Distribution: world Message-ID: <3rorj0$n1c@belfort.daimi.aau.dk> NNTP-Posting-Host: daimi.daimi.aau.dk It is *not* possible to test, (by name), whether an object has some attribute. Doing so would require extensive runtime type information that is currently not available. What you *can* do, is to test whether a given object is an instance of some pattern. For example: Person: (# ... #); o: ^Object; do ... (if o##<=Person## then (* o refers an object that is at least a person. *) if); Here, o## means "a reference to the actual pattern of which o is an instance", Person## means "a reference to the Person pattern", and finally the "<=" operator compares patterns. "<=" applied to patterns returns true iff the lefthand side is a subpattern of the righthand side. Hope this helps. Regards, Soren > > My second question 'Can I know at run-time if an > object supports a specific (by-name) attribute ?' > is for debugging purpose only, also because if > I use extensively that technique I loose benefit > of BETA language and go back to Smalltalk untyped > language. However (maybe) I'll redo the question > when I'll explore singular pattern object or/and > I'll build an example with distributed logic. > > Thanks again, > > Dario Gerosa >