Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!ucsd!ucbvax!TARDIS.CRAY.COM!cargo From: cargo@TARDIS.CRAY.COM (David S. Cargo) Newsgroups: comp.lang.icon Subject: questions about records Message-ID: <9001242131.AA05119@zk.cray.com> Date: 24 Jan 90 21:31:21 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 40 I happened to be looking at an application for rsg.icn from the IPL, when I happened to be looking at the beginning of the program and saw: record nonterm(name) record charset(chars) record query(name) I observed that two records had the same field name ("name"). This prompted a couple of questions that I couldn't find answers to in any of the Icon programming language documentation I looked at (including the book). What are the restrictions on reusing field names from record declarations? For example, you can clearly use the same field name in two different record declarations. You can also use the same field name in two different ordinal locations in two different record declarations. The field names can also be the same as names of local variables (surprise!). That was not what I would have expected. What seems most confusing is from page 222 of the Icon book: record-declaration: record identifier ( field-list ) where the field-list is subscripted with "opt" (meaning optional). The syntax says you can have a declaration like record weird() and I tried that in a test program and it translated without complaint. But what can you use it for? A very puzzled snail, o o \_____/ /-o-o-\ _______ DDDD SSSS CCCC / ^ \ /\\\\\\\\ D D S C \ \___/ / /\ ___ \ D D SSS C \_ _/ /\ /\\\\ \ D D S C \ \__/\ /\ @_/ / DDDDavid SSSS. CCCCargo \____\____\______/ cargo@tardis.cray.com