Path: news.daimi.aau.dk!poe From: Jacob Seligmann Newsgroups: comp.lang.beta Subject: Re: Constants in Beta Date: 26 Apr 1995 08:48:41 GMT Organization: DAIMI, Computer Science Dept. at Aarhus University Lines: 49 Approved: mailtonews@daimi.aau.dk Distribution: world Message-ID: <3nl1d9$a61@belfort.daimi.aau.dk> NNTP-Posting-Host: daimi.daimi.aau.dk Daniel Larsson wrote: > > Baiss E. Magnusson wrote: > > > ... > > > > Now in a real world application these numbers would exist in a separate > > file and they would be reference by some constant name, or they > > would be calculated based upon some environmental setting. > > > > This is accomplished in C with <#defines> so the above would be: > > #define H_WINDOW 100 > > ... > > do (H_WINDOW, V_WINDOW) -> position; > > (WINDOW_WIDTH, WINDOW_HEIGHT) -> size; > > etc. > > > > What method in Beta would you use to replace all hard coded numeric > > values with substitute values? > > What is wrong with this? > > H_WINDOW : (# exit 100 (* or whatever *) #) > V_WINDOW : (# exit 100 (* or whatever *) #) > > Patterns only exiting a constant is the Beta construct most closely > corresponding to C #defines (only they are expressed within the > language instead of a separate language) Yes, and the H_WINDOW: (# exit 100 #); V_WINDOW: (# exit 100 #); do (H_WINDOW,V_WINDOW) -> position; approach is just as efficient as do (100,100) -> position because the exit-values are inlined in the generated code. /Jacob Seligmann ------------------------------------------------------------------------ Systematic Software Engineering A/S Phone: 86 15 18 66 Frichsparken Direct: 86 15 18 22 - 116 Soeren Frichs Vej 42 K Fax: 86 15 19 66 DK-8230 Aabyhoej, Denmark E-mail: jas@systematic.dk ------------------------------------------------------------------------