bcholmes: (Default)
[personal profile] bcholmes

Geek question:

What is the feature of a language that you consider "strong typing"? How does strong typing manifest itself (or not) in your favourite language or two?

(no subject)

Date: 2005-11-17 03:33 pm (UTC)
From: [identity profile] witchicist.livejournal.com
Disclaimer: I don't have a favourite. I only program under duress (like when the developer quits/is fired in the last 2 weeks of a project). I'm usually a business analyst when I do tech stuff. Right now I'm teaching.

I like polyfrog's example, though.

So, characteristics of 'strong typing':
You have to declare your variables before you can use them.
You can only do certain things with the variables.
You will spend hours and hours trying to figure out what the he** is going on with a rounding error because you have accidentally divided a real number by an integer at some point deep in the code and everything from there on is buggered.

The scripting language I use most frequently (Miva-Script, which is an offshoot of HTML-Script) has no typing whatsoever... you can play fast-and-loose with what you do with the variables. If you want to put any restrictions on them you have to specify that within the bit of code you are currently working on.

Pluses - If (variable_name) works just fine as a boolean test
Um... it appeals to my slap-happy nature.

Minuses - You can get different results on the same data if you aren't selectively keeping track of how you are currently using the variable. The output is unpredictable, because it has some history (if you last did a string operation and then switch to integers without telling the program, you will wind up with something other than what you expected.) That is, the language seems to have some typing implicit in it... it would probably be better if that were explicit.

Other possiblity - I'm not really a programmer and I'm making consistent mistakes with my variables.

Profile

bcholmes: (Default)
BC Holmes

February 2025

S M T W T F S
      1
2345678
9101112131415
16171819202122
2324252627 28 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Powered by Dreamwidth Studios