From: Richard J. <ri...@an...> - 2004-08-21 17:06:08
|
On Sat, Aug 21, 2004 at 12:10:36PM -0500, Brian Hurt wrote: > Ah. So, given the following code: > > let rval1, rval2 = > let t = new_list () in > append t 1; > append t 2; > append t 3; > let s1 = freeze t in (* s1 is [1;2;3] *) > append t 4; > let s2 = freeze t in > s1, s2 > ;; > > Sets rval1 to [1;2;3] and rval2 to [4]. > > This is what the code snippet I just posted does. It's be nicer, perhaps, if the fourth "illegal" append statement could somehow generate an error. However, I think generating runtime errors is definitely the wrong thing to do, and at the same time I can't see how to structure the API to generate a compile time error ... Rich. -- Richard Jones. http://www.annexia.org/ http://www.j-london.com/ Merjis Ltd. http://www.merjis.com/ - improving website return on investment Learning Objective CAML for C, C++, Perl and Java programmers: http://www.merjis.com/richj/computers/ocaml/tutorial/ |