[futurebasic] What about Pascal VARs ??

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2001 : Group Archive : Group : All Groups

From: lcs@...
Date: Wed, 18 Apr 2001 02:35:17 +0200 (MEST)

Hi all,

I have a simple syntax question that deserves a simple answer in FB^3.
In reading IM we encounter the convenient Pascal notion of a VAR,
i.e. a variable argument of a FUNCTION whose value is not just 
reveived by the function but whose value can be changed by the 
function.

A sample quote from IM:

FUNCTION GetCurrentProcess  (VAR PSN: ProcessSerialNumber): OSErr;

declares  PSN as a VAR.  The Pascal compiler
passes a pointer to PSN in order to make things work.


Here is some shabby FB^3 syntax that works. 
I've had to use it a zillion times and I'm 
now thoroughly sick of it.

'' CONSOLE MODE
LOCAL FN AssignSevenTo(xptr&)
  xptr&.0&=7 ''means x&=7 in case xptr&=@x&
END FN
''
FN AssignSevenTo(@X&)
PRINT X& '' yields 7

Next, here is some smart proto-FB^3 syntax that does not yet work:

'' CONSOLE MODE
LOCAL FN AssignSevenTo(@X&)
  X&=7
END FN
''
FN AssignSevenTo(@X&)
PRINT X& '' should yield 7

How close can one already come to this elegance 
(yes Pascal is often elegant)
and still get results?

In sum I want FB^3 to deliver the joys of Pascals VAR
syntax through the simplest possible use of @ before 
the variable that is to be treated as a VAR.  
It looks like a piece of cake for Andy G. But maybe 
I am missing something.

Cheers

Larry