Path: news.cs.au.dk!news.net.uni-c.dk!sunsite.auc.dk!newsfeed1.uni2.dk!newsfeed.tli.de!newsfeed.berkeley.edu!nntp2.dejanews.com!nnrp1.dejanews.com!not-for-mail From: Andrew Klaassen Newsgroups: comp.lang.beta Subject: Virtual attribute gives Seg Fault when accessed from pattern ref Date: Sun, 02 May 1999 18:45:39 GMT Organization: Deja News - The Leader in Internet Discussion Lines: 75 Message-ID: <7gi6gi$99i$1@nnrp1.dejanews.com> NNTP-Posting-Host: 207.34.91.216 X-Article-Creation-Date: Sun May 02 18:45:39 1999 GMT X-Http-User-Agent: Mozilla/3.04 (X11; I; Linux 2.2.4 i486) X-Http-Proxy: 1.0 x3.dejanews.com:80 (Squid/1.1.22) for client 207.34.91.216 Xref: news.cs.au.dk comp.lang.beta:11910 Greetings: I don't have a great handle on all of BETA's 'big words' (it took me half an hour just to find the words I needed for my subject line ), so I'll have to explain my question with code. The first program below compiles and runs. The second program compiles, but crashed with a 'Segmentation Fault' at the indicated point. Why? The first program: ORIGIN '~beta/basiclib/v1.6/betaenv'; ---program:descriptor--- (* This program compiles and runs. *) (# Function: (* a simple pattern *) (# a: @integer; Printname: (# do 'Function' -> putline; #); enter a do a -> putint; newline; #); PatRef: ##Function; do Function## -> PatRef##; 3 -> PatRef; PatRef.Printname; #) The second program, which is very similar to the first: ORIGIN '~beta/basiclib/v1.6/betaenv'; ---program:descriptor--- (* compiles but crashes *) (# Function: (# a: @integer; (* Printname is now a virtual pattern *) Printname:< (# do inner #); enter a do a -> putint; newline; #); (* And we have a subpattern of Function, F1, which does a final binding on Printname. *) F1: Function (# Printname:: (# do 'Function' -> putline; #); #); PatRef: ##Function; do F1## -> PatRef##; 3 -> PatRef; (* works *) PatRef.Printname; (* crashed the program with a 'Segmentation Fault' *) #) I'm not very familiar with the use of ## - there aren't many references to it in the BETA Language Intro, Tutorial, FAQ, etc - so I might be using it incorrectly. If anyone could explain what's happening when the second program tries to execute PatRef.Printname, it would be much appreciated. Thanks! -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own