Looking forward, I see a problem with the current naming for User I/O. I see VISIBLE/INVISIBLE as being more appropriate for variable scoping and OOP access control than for input and output. I propose a few simple replacements:

Simple input:

ASK <prompt> <var>

Advanced input:

LISTEN FOR <var>

Simple output:

SAY <expr>

Advanced output: (no automatic newline)

TELL <stream> <raw output>

For the last one, it requires string notation, which I propose below:

"This is a string" / 'This is a single quoted string'

I propose that these strings follow standard perl conventions:

  • Variable interpolation with ${}
  • Escaping with \
    1. Standard characters (\n, \r, \0)
    2. Negate special characters (\\, \”, \')
  • No interpolation within ' '-strings

Kyle, 2007/05/29 05:11


I suggest WUT? instead of ASK, functioning as fgetc.

HAI
BTW LOL
CAN HAS STDIO?
I HAS A VAR VAR2
IM IN YR LOOP
	IZ VAR2 NUTHIN KTHXBYE
        VAR PLUS VAR2
        VAR2 WUT?
IM OUTTA YR LOOP
VISIBLE VAR
KTHXBYE

sokk, 2007/05/29 08:23


Someone else used TXT ME for input, and it seems thats what people like to use:

TXT ME VAR

I agree that VISIBLE and INVISIBLE might not be the best choice for output. Something else is needed.

ISEZ <value>

TXT ME A has been replaced with GIMMEH, with your permission.

And VISIBLE and INVISIBLE were chosen for their ubiquity in simple, BASIC-like programs. LOLCODE is not that sophisticated. Objects? Control over scope? I think we grew up in different decades. ;) — Adam, 2007/05/29 13:13


I know some folks have promoted LOL for setting a variable, but I think it works better as an output, especially if you allow '!' to be a CR/LF:

HAI
CAN HAS STDIO?
I HAS A VAR
IM IN YR LOOP
	UP VAR!!1
	LOL VAR!
	IZ VAR BIGGER THAN 10 O RLY?
          YA RLY
            KTHXBYE
        KTHX
IM OUTTA YR LOOP
KTHXBYE

HAI
  I CAN HAZ LIBARRY "stdio"?

  I HAZ numbar

  W00T "Gimmeh a numbar, kitteh!"

  GIMMEH numbar

  O RLY? Iz numbar BIGGURTHN 5
    YA RLY
      W00T "Numbar biggurthn 5"
    LOL

    NO RLY
      W00T "Numbar iz lamer"
    LOL
  LOL
KTHXBYE

Alan!!111

contributions/user-io.txt · Last modified: 2007/05/30 21:26 by alan-111
Recent changes RSS feed Creative Commons License Donate Driven by DokuWiki