Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!midway!ellis.uchicago.edu!goer From: goer@ellis.uchicago.edu (Richard L. Goerwitz) Newsgroups: comp.lang.icon Subject: Re: Records Message-ID: <1991May31.143815.4204@midway.uchicago.edu> Date: 31 May 91 14:38:15 GMT References: <31.May.91..11: 23:12.bst..060024@EMAS-A> Sender: news@midway.uchicago.edu (NewsMistress) Distribution: inet Organization: University of Chicago Lines: 22 In <31.May.91..11:23:12.bst..060024@EMAS-A> R.J.Hare@edinburgh.ac.uk writes: > >Next question - I am using records as the basis for a simple database >program. Given that the program will be written in a tight enough way to >ensure that it won't be possible to write a list with more elements than >there are in a database entry, what is the advantage of using a record >to store a database entry as opposed to a list? Record field access is much faster than list subscripting. You can also get at the fields by name, and not worry about their order. If you want, though, you can subscript records (as long as you realize that doing so erases most of their method of/speed of access advantages). If you really want to be clever, use a record for all the fields you know you'll be using, but make one member of the record into a list where you can store optional or other fields. You'll get the best of both worlds, at the expense of some clarity and straightforwardness. -- -Richard L. Goerwitz goer%sophist@uchicago.bitnet goer@sophist.uchicago.edu rutgers!oddjob!gide!sophist!goer