Page 1 of 1 1
Topic Options
#79905 - 2001-04-14 02:05 AM Type checking
Anonymous
Unregistered


I’m not sure how many people are aware of this but you can explicitly declare a function with parameter types and a return type.

e.g.

function Foo ( $strVar1 String, $intVar2 Interger ) Integer
; … do something
endfunction

What I would like to see, is type checking for these parameters (if there type was declared).

------------------
Have a good one,
-Ben

"Its funny when you stop doing things not because they're wrong, but because you might get caught." - Unknown

Top
#79906 - 2001-04-14 04:48 AM Re: Type checking
Anonymous
Unregistered


Because Kixtart is deliberately untyped, type checking is contrary to the design of the language. Although I have a strong preference for typed programming languages the fact remains that Kixtart is a scripting language, not a programming language, and therefore has different design objectives.
Top
#79907 - 2001-04-16 12:13 AM Re: Type checking
Anonymous
Unregistered


> Because Kixtart is deliberately untyped, type checking is contrary to the design of the language

I only sugested it because if it supported declaring the type in a function, it should almost naturaly give an error when the wrong type is passed (thus type checking).

Just a thought.

Top
#79908 - 2001-04-16 02:41 AM Re: Type checking
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
You could perform a sort of type checking with VAL:

If a string is "123" then VAL will return 123 and string will equal val(string).

ie:
$a="123"
$b=val($a)

according to kix $a=$b

but, if $a="123x" then $b=123 and $a<>$b

hope this helps


cj


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 764 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.052 seconds in which 0.021 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