On Sun, 2006-09-03 at 19:37 -0400, Peter Tanski wrote:

> // this mess is due largely to List
> val flxPty:Company =
>       C (Cons ((D ("R&D", skaller,
>       (Cons ((PU tryzelaar),
>       Cons ((PU percossi),
>       Cons ((PU tanski),
>       Empty[SubUnit]) ))))), Empty[Dept]));
> 
> var skaller:Manager =
>       E (P ("John Skaller", "email hidden"), S 100000);
> var tryzelaar:Employee =
>       E (P ("Erick Tryzelaar", "email hidden"), S 80000);
> var percossi:Employee =
>       E (P ("Martin Percossi", "email hidden"), S 80000);
> var tanski:Employee =
>       E (P ("Peter Tanski", "email hidden"), S 35000);

BTW: also note this won't work in Felix at present,
because flxPty tried to start work before tanski woke up :)

Generally, expressions are eagerly evaluated, statements
are executed in order of writing, and finally variant
constructors always make a heap copy of their argument:
so you'd be copying an uninitialised variable.

You either need to switch the order, 'semi-lazify' the data
by using a pointer, or 'really-lazify' it by using a closure.
The lazified forms provide sharing and permit updates.

In this case the problem could be eliminated if certain
conditions were met, which include:

* Use 'val' for all these, not var
* no intervening executable code
* reorder eval blocks in dependency order

Perhaps a better syntactic form would be a reordered let:

        reorderlet x = y
        and ...

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to