Page 1 of 2 12>
Topic Options
#101476 - 2003-05-24 12:43 AM BUG: KiXtart 4.21
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
does anyone concur with me that the following test script produces abnormal behavior?

code:
$a = "1~2"
$i=$a
gosub A
$a=$i
for each $x in $a
? "'$x'"
next

;Only 'return' works. Try using 'exit' and 'quit'
;exit
;quit
return

:A
$i=split($i,"~")
return

When using either "exit" or "quit", the following error occurs.
quote:
ERROR : Error in expression: this type of array not supported in expressions.!


[ 24. May 2003, 00:43: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#101477 - 2003-05-24 02:38 AM Re: BUG: KiXtart 4.21
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I chalk it up to be poor coding. [Big Grin]

What is happening is that Quit and Exit both take an expression that follows and tries to enumerate it as the exit code. This has happened in previous versions in certain circumstances.

Best practice dictates that one should always pass a value with Quit and Exit.

code:
break on
$a = "1~2"
$i=$a
gosub A
$a=$i
for each $x in $a
? "'$x'"
next

;Not only 'return' works. Try using 'exit 1' and 'quit 1'
exit 1
;quit 1
;return

:A
$i=split($i,"~")
return

{edit - Jooel had posted a couple of comments but obviously had a change of heart and deleted them leaving Chris and Shawn's comments below out of context}

[ 24. May 2003, 15:11: Message edited by: LLigetfa ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#101478 - 2003-05-24 02:57 AM Re: BUG: KiXtart 4.21
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
I agree. (You pick who I agree with.) [Wink]
Top
#101479 - 2003-05-24 02:57 AM Re: BUG: KiXtart 4.21
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
[Razz]
Top
#101480 - 2003-05-24 03:06 AM Re: BUG: KiXtart 4.21
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Yeah, yeah, but the documentation states that the exit code is OPTIONAL. OPTIONAL means that it is not required for the program to function.

Therefore, draw your own conclusion. [Roll Eyes]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#101481 - 2003-05-24 03:47 AM Re: BUG: KiXtart 4.21
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
OK, I agree that it is an optional parameter but...

KiX tries to enumerate what follows, but what follws throws an error.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#101482 - 2003-05-24 03:00 PM Re: BUG: KiXtart 4.21
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
At the very least, the manual should strongly suggest that the "Optional" exit code be included or else an expression that follows could be executed with possible consequences.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#101483 - 2003-05-24 03:02 PM Re: BUG: KiXtart 4.21
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Agreed. I think that if the numeric does not come before the CR then no eval is done.

[ 24. May 2003, 15:02: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#101484 - 2003-05-24 03:24 PM Re: BUG: KiXtart 4.21
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
But is CR a valid delimiter? We know that almost all the CRs can be removed and the script will still run. What then?

Better I think, is to make it less "Optional".

{brain fart}
Perhaps it could also be made into a function with the obligatory parens.

i.e.
EXIT(Your Expression Here)

That way, if a parens is encountered, then evaluate what is within it else treat it as the command it is now.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#101485 - 2003-05-24 03:26 PM Re: BUG: KiXtart 4.21
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
That may be the best solution yet.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#101486 - 2003-05-24 03:41 PM Re: BUG: KiXtart 4.21
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I think this discussion has a long way to go yet. More verbosity in the manual certainly will help in the immediate term. Long term, we need to promote a "best practice" to align to a "new" method that could split EXIT in two.

1. A command as it is now but with a twist. The twist being to have several options.

EXIT FOR
EXIT WHILE
EXIT DO

2. A function that allows an expression.

When there is a rule change, it will invariably break someone's script so careful considerations and liberal amounts of education are required.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#101487 - 2003-05-24 06:43 PM Re: BUG: KiXtart 4.21
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
How about making EXIT default to 0 if no exit code is provided. I believe this will reflect the intentions of the coder when they use EXIT and keep the change in the EXIT behavior backward-compatible.

[ 24. May 2003, 18:44: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#101488 - 2003-05-24 07:32 PM Re: BUG: KiXtart 4.21
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
actually, jens that sounds like it currently is.
_________________________
!

download KiXnet

Top
#101489 - 2003-05-24 08:24 PM Re: BUG: KiXtart 4.21
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Actually, right now it tries to evaluate whatever comes next, thus the bug report.
_________________________
There are two types of vessels, submarines and targets.

Top
#101490 - 2003-05-25 08:28 AM Re: BUG: KiXtart 4.21
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
sure, as it is the provided exit code!

how do you determine what is the exit code and what is not?
_________________________
!

download KiXnet

Top
#101491 - 2003-05-25 03:22 PM Re: BUG: KiXtart 4.21
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
The next space-separated item behind EXIT must be either a string, number, variable, or something that evaluates to a number to generate an exit code.
code:
exit '0'
exit 0
exit @ERROR
exit $exitcode
exit val(readvalue('hklm\software',''))

_________________________
There are two types of vessels, submarines and targets.

Top
#101492 - 2003-05-25 03:55 PM Re: BUG: KiXtart 4.21
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Agreed. Well, need to think about the string part for a minute. Maybe it would auto Val() it or something.

In a perfect world that is how it would be. In the case of Howard's example, the :A perhaps should have delimited the command but it did not.

How can KiX know if the expression that follows generates a number unless it is enumerated?

Even in the perfect world, if the expression that follows, whether it would return a number or not, throws an error (as in Howard's example) then KiX still dies. How can KiX ignore such an error? KiX cannot be expected to second guess the intent of the expression. An error is an error and it has no choice but to bomb.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#101493 - 2003-05-25 04:09 PM Re: BUG: KiXtart 4.21
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I think it is as simple as ALL input to any function or command should be qualified by being wrapped in ()'s. No ()'s no input to be evaluated.

{edit} See Les' post above. [Wink]

[ 25. May 2003, 20:58: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#101494 - 2003-05-25 08:47 PM Re: BUG: KiXtart 4.21
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
At the risk of quoting (repeating) myself...
quote:
i.e.
EXIT(Your Expression Here)


_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#101495 - 2003-05-25 09:40 PM Re: BUG: KiXtart 4.21
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
qualified...

I might be repeating myself...
jens, linefeed is also space so one can actually place as many subfunctions and scripts into the exit value as he likes.

les/hoby,
are you guys saying that exit should be from now on a function instead of current command?
_________________________
!

download KiXnet

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 657 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.086 seconds in which 0.038 seconds were spent on a total of 13 queries. Zlib compression enabled.

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