Path: news.cs.au.dk!news.net.uni-c.dk!howland.erols.net!news.maxwell.syr.edu!nntp2.dejanews.com!nnrp1.dejanews.com!not-for-mail From: Andrew Klaassen Newsgroups: comp.lang.beta Subject: Re: Virtual attribute gives Seg Fault when accessed from pattern ref Date: Mon, 03 May 1999 14:16:33 GMT Organization: Deja News - The Leader in Internet Discussion Lines: 68 Message-ID: <7gkb3t$vho$1@nnrp1.dejanews.com> References: <7gi6gi$99i$1@nnrp1.dejanews.com> <372D57DD.41C6@cs.au.dk> NNTP-Posting-Host: 207.34.91.186 X-Article-Creation-Date: Mon May 03 14:16:33 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.186 Xref: news.cs.au.dk comp.lang.beta:11912 In article <372D57DD.41C6@cs.au.dk>, Kasper Dupont wrote: > Andrew Klaassen wrote: > > > > Greetings: > > ---snip--- > > > > do > > > > F1## -> PatRef##; > > 3 -> PatRef; (* works *) > > PatRef.Printname; (* crashed the program with a > > 'Segmentation Fault' *) > > ---snip--- > > > > You can not use an attribute on a > pattern directly, you must first > create an object from the pattern > before you can use the attribute. > > Both your examples should get an > "An object is expected here" error > at compilation. To me it looks like > a bug in the compiler. > > (**** should not compile ****) > PatRef.Printname; > > (**** this should work ****) > (# TempObject: ^Function; > do > &PatRef[]->TempObject[]; > TempObject.Printname; > #); > > /KD > So this is basically the same as trying to do .... Function: (# ... Printname: (#...#); do ... #); .... do Function.Printname; (* doesn't compile *) .... which doesn't compile at all. Nor does &Function.Printname; Why not? It's my understanding (and I may be way off) that when I execute something like 3 -> Function; (* or, for that matter, 'Hi' -> putline; *) an unreferenced instance of Function is created, executed, and, presumably, eventually picked up by the garbage collector. Couldn't the same thing be done when an attempt is made to use a reference of an attribute of a function? Thanks! -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own