Page 1 of 1 1
Topic Options
#168096 - 2006-09-19 04:19 PM Print Statement
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Ruud(etal),

Would like to suggest you add a PRINT statement to Kixtart. The syntax would be like:

PRINT <expr>

So for example, the following statements:

PRINT "Hello World"
PRINT 1+2

would yield

C:\>kix32 test
Hello, World
3

Obviously we can "print" to the console today - by leaving the result of an expression "hangin-out there" (an unassigned expression) - but here's the thing ...

Just like with explicit vars and vars in strings etc - this would help in moving Kixtart to a more formalized usage. Maybe even leading to one day - having a SetOption that will suppress writing un-assigned expressions to the console. So that suppressing return codes like this:

$RC = SetOption(...)
$RC = WriteValue(...)

Might be a thing of the past one day. Discussion welcome.

-Shawn

Top
#168097 - 2006-09-19 04:24 PM Re: output Statement
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
if there is gonna be a statement called print, make it function.
so one day, we hopely can also add the target for printing.
file, pipe, network connection etc... even a printer.

Top
#168098 - 2006-09-19 04:29 PM Re: output Statement
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
true - was just trying to keep with the old BASIC syntax. I think PRINT supports writing to "a handle" like this:

PRINT <expr>
PRINT #n <expr>

where n is a FileHandle from Open().

Agreed though.

Top
#168099 - 2006-09-19 04:44 PM Re: output Statement
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I was thinking as far as command prompt :P
Top
#168100 - 2006-09-19 05:42 PM Re: Print Statement
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Oh yeah - and how about a ...

SetOption("BEEP", "Off")

... to supress those syntax error beeps ;0)

Top
#168101 - 2006-09-19 08:55 PM Re: output Statement
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Quote:

if there is gonna be a statement called print, make it function.
so one day, we hopely can also add the target for printing.
file, pipe, network connection etc... even a printer.




I'll put my two cents in the basket for this one.
Something like:

Print("What", "How", "Where")
What = stuff to print like a word doc to a printer or var to the console.
How = C for console, P for printer.
Optional Where = Printer.

Code:

$rc = Print("C:\somefile.txt", "P", "\\server\printersharename")



or

Code:

$rc = Print($var, C)



Especially the printer part got me interested cause I had some shittie issues with the print and printto UDF's lately.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#168102 - 2006-09-19 09:01 PM Re: output Statement
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
well, I would see more generalised version:
print(WHAT,optional WHERE)

if WHERE is omitted, WHAT prints on console.
if WHERE is specified, it says the target to output the stream to.

in most cases that would mean opening the stream just like open() does for files now.
that brings to mind, writeline could act as print() if it would support other streams, not just files.

Top
#168103 - 2006-09-19 09:10 PM Re: output Statement
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Quote:


....
print(WHAT,optional WHERE)

if WHERE is omitted, WHAT prints on console.
if WHERE is specified, it says the target to output the stream to.
....





Hmmm.... When thinking about it this sounds much better.

BTW: So now people are starting to golf not just scripts but even suggested commands and/or functions. LOL
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#168104 - 2006-09-20 08:46 AM Re: output Statement
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

that brings to mind, writeline could act as print() if it would support other streams, not just files.




That would definately be my suggestion. Hang on, it was...
http://www.kixtart.org/ubbthreads/showth...page=0&vc=1


Top
Page 1 of 1 1


Moderator:  Lonkero, ShaneEP, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 579 anonymous users online.
Newest Members
min_seow, Audio, Hoschi, Comet, rrosell
17881 Registered Users

Generated in 0.057 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org