Path: news.daimi.aau.dk!news.uni-c.dk!sunic!sunic.sunet.se!news.luth.se!eru.mt.luth.se!bloom-beacon.mit.edu!gatech!howland.reston.ans.net!Germany.EU.net!Dortmund.Germany.EU.net!Informatik.Uni-Dortmund.DE!warda From: warda@fbi-news (Armin M. Warda) Newsgroups: comp.lang.beta Subject: How to obtain a ref. to current _component_ obj.? Date: 25 Apr 1995 14:22:07 GMT Organization: CS Department, University of Dortmund, Germany Lines: 89 Message-ID: <3nj0if$6hh@fbi-news.informatik.uni-dortmund.de> NNTP-Posting-Host: veronica.informatik.uni-dortmund.de Summary: Is there a construct to obtain a reference to the current _component_ object? Keywords: component,current,this X-Newsreader: TIN [version 1.2 PL2] I encountered the following problem during the design of a generic abstract superpattern 'time management' which can be further specialized for 1) event-driven simulation or 2) process-oriented simulation. The abstract superpattern 'time management' deals with time-ordering of objects that either 1) contain a pattern reference (to be used as event-routines for event-driven simulation) or 2) are coroutines (to be used as processes for process-oriented simulation) Why is the following illegal for the BETA-Compiler [Mjolner BETA System version 5.0(2) for SUN-4]? (# Process: (# me: ^|Process; do this(Process)[]->me[]; INNER #); A: @|Process (# do 'A' -> putline #); do A; #) This error message is displayed by the compiler: THIS(Process)[]->me[] ***** Illegal assignment/comparison of value, reference or repetition Is there a construct to obtain a reference to the current _component_ object? ============================================================================= The same problem arises with this example taken from the BETA-Book [Madsen93, P.197, Figure 13.10]: SymmetricCoroutineSystem: (# SymmetricCoroutine: (# Resume:< (# do this(SymmetricCoroutine)[]->next[]; SUSPEND (* suspend caller *) #) do INNER #); Run: (* start of initial SymmetricCoroutine *) (# enter next[] (* global reference declared below *) do ScheduleLoop: Cycle (# active: ^| SymmetricCoroutine (* currently operating component *) do (if (next[]->active[]) = NONE then leave ScheduleLoop if); NONE->next[]; active; (* attach next SymmetricCoroutine *) (* Active terminates when it executes either *) (* resume, or suspend or it terminates *) #) #); next: ^| SymmetricCoroutine; (* Next SymmetricCoroutine to be resumed *) do INNER #) The Mjolner BETA System - BETA Compiler - Reference Manual [MIA 90-02(1.3), P.7, Ch.5 'Implementation Restrictions'] gives a hint to this strange behaviour of the compiler, but lacks an explanation or work-around: "11. Consider the following example: A: (# X: ^P; (* reference to item qualified by P *) B: ^|P (* reference to component qualified by P *) do ... this(p)[] -> X[]; (* legal use of this(P)[] *) this(P)[] -> B[]; (* illegal use of this(P)[] *) #) The illegal use is due to the fact that this(P)[] is considered a reference to an item object and not a component object." Is there a work-around for this problem? ======================================== Yours sincerely, Armin. --------------------------------------------------------------------- Armin M. Warda Universitaet Dortmund, Informatik IV, GB V, R.503, Tel: 0231-755-4824 44221 Dortmund, Privat: , Tel: 0231-75-37-30 WWW: "http://ls4-www.informatik.uni-dortmund.de/QM/MA/warda/pi.html" PGP fingerprint = 66 C0 3E 8E D9 FE 61 77 DB 37 0D 40 36 53 71 6A