Is the quality of a language where it's not required to declare a variables type an example of weak typing or dynamic typing -


is quality of language it's not required declare variables type (such php , perl) known weak typing or dynamic typing? i'm having trouble getting head around 2 terms.

am right dynamic/static typing pertains type conversion whereas weak/strong typing pertains deceleration of variable?

according to: http://en.wikipedia.org/wiki/type_system#static_and_dynamic_type_checking_in_practice

weak typing means language implicitly converts (or casts) types when used.

whereas:

a programming language said use static typing when type checking performed during compile-time opposed run-time.

so, strong/weak , static/dynamic 2 different dimensions. language 1 of strong/weak, , 1 of static dynamic. instance, ruby , javascript both dynamically typed, ruby typed while javascript weakly typed. is, in ruby following code give error:

1.9.2p290 :001 > 'a'+1 typeerror: can't convert fixnum string 

whereas in javascript, get:

> 'a'+1 >> 'a1' 

so, typed language requires convert 2 variables same type in order combine them (eg. using 1.to_s), while weakly typed language attempt coerce 2 variables same type using built-in language logic - in javascript's case, combining string convert string value.

see: http://www.artima.com/weblogs/viewpost.jsp?thread=7590 further explanation.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -