Path: news.cs.au.dk!not-for-mail From: nospam2159@cs.au.dk (Peter von der Ahé) Newsgroups: comp.lang.beta Subject: Re: Virtual attribute gives Seg Fault when accessed from pattern ref Date: 04 May 1999 18:08:08 +0200 Organization: University of Aarhus, Department of Computer Science (DAIMI) Lines: 43 Message-ID: References: <7gi6gi$99i$1@nnrp1.dejanews.com> <372D57DD.41C6@cs.au.dk> <7gkb3t$vho$1@nnrp1.dejanews.com> <7glcj3$tu7$1@nnrp1.dejanews.com> NNTP-Posting-Host: ufleku.cs.au.dk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: xinwen.cs.au.dk 925833902 2177277 255.255.255.255 (4 May 1999 16:05:02 GMT) X-Complaints-To: news@cs.au.dk NNTP-Posting-Date: 4 May 1999 16:05:02 GMT X-Attribution: Ahe User-Agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.3 Xref: news.cs.au.dk comp.lang.beta:11920 >>>>> "AK" == Andrew Klaassen writes: [snip] AK> However, code speed might be important in regard to some of my AK> other functions. Something like, say AK> IntegerPartOfLog2: AK> (# value,i: @integer; AK> enter value AK> do AK> ... AK> exit (i - 1) AK> #); AK> Normally, I'd call this like so: AK> i,a: @integer; AK> do AK> (for i:30000 repeat i -> IntegerPartOfLog2 -> a; ... for); AK> (Don't worry - in the actual code, I use the function far more AK> intelligently than this.) The "..." can be arbitrarily complex ;-) AK> Would my code be faster overall (since the function will be AK> called many times, and since I never need more than one copy of AK> it) if I made IntegerPartOfLog2 a singular object rather than a AK> pattern? (I guess that that would depend on whether i-> AK> IntegerPartOfLog2 creates a new instance of the pattern each time AK> it's executed or not.) [snip] Yes, writing IntegerPartOfLog2 is exactly the same as writing &IntegerPartOfLog2 in the Mjolner BETA system. Thus it will be much faster if you do someting like: theIntegerPartOfLog2: @IntegerPartOfLog2 do (for i:30000 repeat i -> theIntegerPartOfLog2 -> a; ... for) Cheers, Peter