Path: news.cs.au.dk!news.net.uni-c.dk!uninett.no!news.maxwell.syr.edu!newscore.univie.ac.at!skynet.be!poster!not-for-mail From: Jean-Louis Leroy Newsgroups: comp.lang.beta Subject: Beginner at work: two dimensional value-based array generic Date: Mon, 14 Dec 1998 22:28:11 +0100 Organization: Starfleet Lines: 44 Message-ID: Reply-To: jll@skynet.be NNTP-Posting-Host: dialup382.brussels2.skynet.be Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news1.skynet.be 913670329 15510 195.238.24.126 (14 Dec 1998 21:18:49 GMT) X-Complaints-To: abuse@skynet.be NNTP-Posting-Date: 14 Dec 1998 21:18:49 GMT X-Newsreader: Virtual Access by Ashmount Research Ltd, http://www.ashmount.com Xref: news.cs.au.dk comp.lang.beta:11751 Hello, As an exercise, I'm attempting to create a generic two-dimensional array of values. Here's what I've got so far: (# Array: (# type:< object; nx,ny: @integer; data: [0] @type; resize: (# newx,newy: @integer; singular: @type enter (newx,newy) do (newx*newy)->data.extend; (for i: data.range repeat singular->data[i] for); (newx,newy)->(nx,ny) #); #) #) 1) singular->data[i] doesn't compile because the compiler sees an invalid assignment. I don't see why (it would be nice if the compiler reported the types of both sides). 2) I looked at arrayContainer and noticed that the container stores references instead of values. OTOH, C++ standard containers are all value-based, if you want a container of pointer you simply make a container of values that are of pointer type (e.g. vector). When my Array pattern works I suppose I can use it as an array of references as well: arrayOfFooRefs: Array (# type::< ^Foo #) Will it work? If yes, why is arrayContainer designed the way it is? Thus far I think that BETA is a fascinating language, I hope I can get hold of the books soon and be done asking stupid questions ;) Jean-Louis Leroy http://ourworld.compuserve.com/homepages/jl_leroy/