Print to STDOUT
VISIBLE <expression>[!]Prints the value of the expression as concisely as possible (i.e. just the string, just the number, each element of the array on a separate line, etc). No newlines (or element separators for an array) are to be output if the statement ends with a !
I think arrays should be printed with a newline delimiting elements because conceptually, I think calling a command with an array and no range or single value should execute that command on each individual argument. Since VISIBLE'ing an individual element appends a newline, I propose that these newlines are maintained. The same goes with !, except there is no newline, so all array elements are squashed together with no separator.
I know it's part of the original example, but “VISIBLE” doesn't scream LOLCODE at me. How about something like ”<destination> SEEZ <expression>[!]” where <destination> is the output stream, such as:
STDOUT SEEZ "Hai Werld!"
or even better, if standard out were simply named “U” as in:
U SEEZ "Hai Werld!"
-danfuzz
I like VISIBLE. It's a play on “INVISIBLE <X>” and I think it works. It's simple and obvious. Other destinations could have a different form.
— Steve Losh, 2007/06/03 20:44
I'm with danfuzz on this. The ”<stream> SEEZ <output>[!]” is not only well within the spirit of LOLCODE but also is flexible enough to work with different output streams. VISIBLE would require different keywords (theoretically) for, say, file i/o or stderr output, but making something like “STDERR SEEZ 'OH NOES'” or “TEHFILE SEEZ ':O'” in a grand unified way is elegant.
- teh_lee
I also am not enamored with this use of the VISIBLE keyword. For one thing, it seems to preclude use of the keyword INVISIBLE for anything useful. Personally I'd like to see something based off of the “LET ME SHOW YOU MY <output>” for this. Yeah, too wordy, but it's a start.
Or, alternatively, what would you think about:
FILECAT WANT <filename> FILECAT SAYS <output> FILECAT DO NOT WANT <filename>
Of course, this block opens a file, writes output to that file, and closes it. Maybe CAT is an accepted format for naming a stream? Maybe STDCAT is reserved for standard I/O. That or venereal diseases.
Anyways, back on topic - for some reason I'm thinking VISIBLE/INVISIBLE would be a good way to bring a variable in and out of scope for a give block, though I don't immediately see the usefulness of it at the moment. Hey, it's different. — Reverend Loki, 2007/06/05 20:31
I'd like to see ”<stream> SEZ 'text'” as the method of choice for outputing in general, but maybe VISIBLE could be a wrapper for “STDCAT SEZ”? CAT sounds like a good name for a stream, BTW ;) Also note that I used SEZ, 1 “E” otherwise it looks as if the stream is looking at the text… I don't know — Zenix, 5 June 2007 7:42
You know, if we wanted to be really evil, we can make SEZ (says) the output stream functions, and SEEZ (sees) the input stream function. Makes debugging I/O errors all that much more fun! — Reverend Loki, 2007/06/07 22:43
I agree that VISIBLE feels not in the spirit of catmacroese, although I do think the pun is funny. I'm a fan of SEZ/SEEZ, that's just awesome. What if the input comes on the right, and U was the stdin stream? (as if the program executor was talking to the user) “I SEEZ U” would grab a line of input? — BadZen, 2007/06/28 13:19
I agree with SEEZ as well - it makes sense in a stream context just like iostreams in C++ (cout « “Hi!”, cin » myVar, etc.). I think VISIBLE and INVISIBLE would make better keywords to describe the visibility of variables (public vs. private):
OH HAI
I CAN HAS STDIO?
(class declaration: Cabinet)
I HAS A VISIBLE food1 ITZ "Cheez" ALWAIZ
I HAS A INVISIBLE food2 ITZ "Burger" ALWAIZ
(end class declaration)
I HAS A foodbox ITZ A Cabinet
U SEEZ "Food1 in foodbox = ".food1 IN MAH foodbox
U SEEZ "Food2 in foodbox = ".food2 IN MAH foodbox
O NOES
BTW Second line causes an error because food2 is INVISIBLE.
U SEEZ "I has no Burger in foodbox!!!!1!!1"
GTFO
KTHX
KTHXBYE
Does this make sense? — KieferSkunk, 2007/07/23 20:56
Excellent sense! The one addition I would make would be that VISIBLE would be the default paramater setting. As such,
I HAS A VISIBLE food1 ITZ "Cheez" ALWAIZ
and
I HAS A food1 ITZ "Cheez" ALWAIZ
would execute identically. Specifying VISIBLE would help make apparent what is in scope vs out of scope for anyone reading the code, but would be optional. — Reverend Loki, 2007/07/26 19:55
I was thinking an addition that would make this more obvious and seeming less formal [as visible reminds me of pulling up a visual basic form]. would be burrowed from our friend neighbour hood ditz. Who would use, sooo… like obviously ex.
sooo 'hello world' like obviously
and for continuation onto another line
soo 'hello ' like obviously you know soo 'word' like obviously
I believe that VISIBLE and INVISIBLE should be something that really shouts LOLCODE! I was thinking along the lines of this:
LET ME SHOW U MAI <var>! BTW This one for VISIBLE UR NOT GETTIN MAI <var>! BTW This one for INVISIBLE
These two phrases crop up a lot in the original LOLCAT memes, and it's only fitting that they should have a place in LOLCODE.
one more vote for SEZ or JUS-SAYIN
KTHXBYE!