Path: utzoo!mnetor!uunet!husc6!bloom-beacon!think!ames!sdcsvax!ucsdhub!hp-sdd!hplabs!hpda!hpesoc1!hpcllla!hpclisp!hpclscu!shankar From: shankar@hpclscu.HP.COM (Shankar Unni) Newsgroups: comp.lang.pascal Subject: TP problem Message-ID: <950003@hpclscu.HP.COM> Date: 19 Dec 87 00:31:49 GMT References: <159@conexch.UUCP> Organization: HP ITG/ISO Computer Language Lab Lines: 41 > >In article <1808@rayssdb.RAY.COM> Richard A. Brooks writes: >>In article <936@sask.UUCP>, Kevin Lowey writes: >>> In article <16249@topaz.rutgers.edu>, Jonathan Joshua writes: >>> > >>> > [ the preceeding discussion about enumerated type I/O ] >>> [...] >> Try this: >>program TEST; >> >>type >> ON_OFF = (ON,OFF); >>var >> v = ON_OFF; >>begin >> readln(v); >> writeln('Switch is now ',v); >>end. >> >> Upon compiling the above, you will recieve an I/O not >> allowed error at the "readln(v)" and the "writeln(v)", >> if the readln is removed. > Eric Pedersen replies: >...... To accomplish this, the compiler would >have to keep the actual character names of every enumerated type in the >object program, wasting lotsa space, and complicating the TEXT library >I/O routines. Well, a few compilers (decent ones, btw) written for larger machines DO support this feature exactly as you describe (a table is dumped somewhere for each enumerated type for which I/O is requested). And yes, the code generated for the I/O *is* a little gnarly. But boy! is it worth it!! Input may not be too important (and may be counter-productive, because user typos will not be handled too gracefully), but output is certainly useful, if for nothing else but for debugging purposes. Shankar Unni. ...!hplabs!hpda!shankar