There's a bug in pool class:
////
typedef member_t = (free:bool,member:s);
struct pool =
{
members : list[member_t];
get_next : unit ->opt[s];
initialized : bool;
};
publish """ iterates over a list members rotating back to start of list """
/* TODO: pull non free members out of rotation, once this happens
need to determine how to handle allocation of all members.
block? Error out? */
gen get_next_member(p:&list[member_t]) ():opt[s] ={
var rotation = *p;
while true do
match rotation with
| Cons (?h,?t) => h.free=false;yield Some h.member;rotation = t;
*************
| Empty[list[s]] => rotation = *p;
endmatch;
done
return None[s];
}
///
It's not legal to assign to a value. A ?v variable in a pattern is
a value.
I'm not sure I understand what pool is doing, it seems a little
complex for what is basically just a list.
Anyhow, you can't mutate a list element, since lists are purely
functional. You have to make a list of pointers instead.
--
john skaller
[email protected]
http://felix-lang.org
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language