Partial values.



%%%% Partial values: values who elements are unbound,
%%%% and may be bound later

declare
X %% unbound at this point
Y %% unbound at this point
Ann = person(name: 'Ann' age: X gpa: Y)

{Browse Ann}
%%% field selector:
{Browse Ann.name}

%%% We can provide the name later
%declare
thread {Delay 6000} X = 20 Ann.gpa = 3.4 end

%%% Note that = makes two identifiers refer to the same variable,
%%% so setting one sets the other:
{Browse Y}

%%% Procedures can also be partial values:
declare
Z
proc {Add U}
   Z = U + X
end

{Browse Add}

%%% The procedure will be called once X is bound:
{Add 5}
{Browse Z}

CSci 4651 course web site.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.