A strongly typed language requires you to declare the data type of all variables ahead 
of time. All functions return values that are of a specific type. All operators act on 
values of specific data types.

For example, assume you have a function nth( list, n) that returns the nth value of a 
list where a list is a string with comma separated values. nth might be declared as 
follows:
      string nth( string list, integer n)

It would be an error to pass anything but a string as the first argument. It would be 
an error to pass anything but an integer as the second argument. It would be an error 
to assign the results to anything but a string variable.

string list = "10,20,30,40";
string val;
integer n=2;
integer m;

val = nth( list, n);    ( val = the string "20")
m = nth( list, n);    (ERROR because nth returns a STRING not an integer)
val = nth( list, "3")  (ERROR because "3" is a string)
val = nth( list, 3)    (val = the string "30")

If you need to get around these restrictions you need to explicitly convert the 
datatypes:

m = convert( nth( list, 3), "integer")
or
m - (int) convert( nth( list, 3))   (this is how 'C' does it)


The advantages of a strongly typed language are the compiler/run-time system can catch 
subtle errors because you are so explicit about what data types are being passed 
around.
The disadvantage is it's a pain to have to declare everything ahead of time and to 
convert values all over the place.

Most "typed languages" are not quite this strict and will do many automatic 
conversions for you.


At 08:21 AM 11/7/00 -0800, Warrick, Mark wrote:
>For the sake of us non-programmers could you explain what "typed language" means?
>
>---mark
>
>--------------------------------------------------------------
>Mark Warrick
>Phone: (714) 547-5386
>Efax.com Fax: (801) 730-7289
>Personal Email: [EMAIL PROTECTED]
>Personal URL: http://www.warrick.net 
>Business Email: [EMAIL PROTECTED]
>Business URL: http://www.fusioneers.com
>ICQ: 346566
>--------------------------------------------------------------
>
>
>> -----Original Message-----
>> From: Jeffry Houser [mailto:[EMAIL PROTECTED]]
>> Sent: Tuesday, November 07, 2000 5:40 AM
>> To: CF-Talk
>> Subject: Is Cold Fusion a Typed Language?
>> 
>> 
>> 
>>   I've heard in quite a few places that ColdFusion is a typed language?
>> However, it acts as an untyped language.  Can anyone verify for me which 
>> one is actually true?
>>   
>>   You don't declare variables a type when you create them, and you 
>> can typically change a variable from a string to an integer without 
>> a second thought.  I was told that ColdFusion handles all data 
>> conversion internally to take the burden off the user, but for 
>> efficiency's sake, it's best not to switch the type of a variable if 
>> you can avoid it.
>> 
>>   And if Cold Fusion is a typed language, what are the simple types? 
>> The standard string, integer, float, and boolean?  
>> 
>> -- 
>> Jeff Houser
>> AIM: Reboog711  | ICQ: 5246969 | Phone: 860-229-2781
>> --
>> DotComIt, LLC
>> Computer Consultant specializing in database driven web data
>> Lotus Notes/Domino, Cold Fusion
>> --
>> Half of the Alternative Folk Acoustic Duo called Far Cry Fly 
>> http://www.farcryfly.com
>> http://www.mp3.com/FarCryFly
>> --
>> Does Everyone Think I'm a Cynical?
>> ------------------------------------------------------------------
>> ------------------------------
>> Archives: http://www.mail-archive.com/[email protected]/
>> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists 
>> or send a message with 'unsubscribe' in the body to 
>> [EMAIL PROTECTED]
>
>------------------------------------------------------------------------------------------------
>Archives: http://www.mail-archive.com/[email protected]/
>Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebarsts or send a message with 
>'unsubscribe' in the body to [EMAIL PROTECTED] 


---------------------------------------------------------------------------
Peter Theobald, Chief Technology Officer
LiquidStreaming http://www.liquidstreaming.com
[EMAIL PROTECTED]
Phone 1.212.545.1232 x204 Fax 1.212.545.0938

To put this contact information into your Palm device, click here:
http://www.coola.com/cgi-bin/addinfo.cgi?pid=15803&rid=972879910&type=A


------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to