[clean-list] newbie: simple console IO and 65536

Maks Verver m.verver@student.utwente.nl
Wed, 12 Mar 2003 14:09:33 +0100


Hi Isaac,

I usually work around this by returning something other than world. For
example:

Start:: *World -> String
Start world 
#	(console, world) = stdio world
	(ln, console) = freadline console
	console = fwrites ln console
	(ok, world) = fclose console world
|	not ok = abort "problem!"
= ""

This works because the empty string is invisible if the console is set
to "basic values only". However, I think is a rather inappropriate hack.
It would be much nicer if either World objects would not be printed at
all (since their integer representation isn't very useful), or there
would be an option to turn of printing the result value.

Either way, it would be possible to write a number of potential Start
rules and select the right one at run-time, or execute several functions
in sequence (using the seq-function on a list of functions of type
*World->*World, for example). This is possible now, but only with a
work-round like above.


Kind regards,
Maks Verver.



> -----Original Message-----
> From: clean-list-admin@cs.kun.nl 
> [mailto:clean-list-admin@cs.kun.nl] On Behalf Of isaac gouy
> Sent: dinsdag 11 maart 2003 5:39
> To: clean-list@cs.kun.nl
> Subject: [clean-list] newbie: simple console IO and 65536
> 
> 
> Puzzled by the behaviour of this simple console IO
> program (on Windows XP). After echoing back an
> inputline, 65536 appears on the console? How do I
> avoid this behaviour?
> 
> ---------------
> module echoline
> import StdEnv
> 
> Start:: *World -> *World
> Start world 
> 	# (console, world) = stdio world
> 	  (ln, console) = freadline console
> 	  console = fwrites ln console
> 	  (ok, world) = fclose console world
> 	|  not ok = abort "problem!"
> 	= world
> ---------------
> I:\Clean>echoline -con
> input line
> input line
> 65536
> ---------------
>