Page 1 of 1 1
Topic Options
#134496 - 2005-02-24 05:59 PM Function names that start with a number...
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Maby i just have never tried to name a function that started with a number... but it looks like you can't. has it always been like this?

Code:

10to3(10)


Function 10to3($number)
? "running 10to3"
EndFunction



the above code will print a "10" to the screen then error out.

ERROR : unknown command [to3]!
Script: G:\kix\sandbox\test.kix
Line : 3
This happens in 4.23, and 4.50beta


Bryce

Top
#134497 - 2005-02-24 07:35 PM Re: Function names that start with a number...
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Get the same error..

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#134498 - 2005-02-24 08:12 PM Re: Function names that start with a number...
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
It seems to me a ran across this one time as well. I just assumed it was by design.
_________________________
(... better days ahead)

Top
#134499 - 2005-02-25 11:20 AM Re: Function names that start with a number...
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Seems reasonable.

The parser will see the leading digit and assume that it is being presented with a numeric constant. The constant ends at the first non-numeric character (the "t").

The undefined action for an expression on the stack is to print it.

So, you get a "10" output to the screen, then the process chokes because is doesn't know what to do with the "to3" token.

I bet if you had a "to3" UDF it would have executed it.

Perhaps the "Function" declaration should complain about illegal function names.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 1452 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.057 seconds in which 0.03 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