Home » questions » about programming langauges?

about programming langauges?

2006-08-01 07:06:09, Category: Programming & Design
how can we compare weak and strong typing. Argue why it is OK to have weak typing in scripting languages but not in the general purpose languages such as Java and C++. Consider the following 5 binding times: 1- Language design time 2- Program writing time 3- Compile time 4- Load time 5- Run time Plesae give at least one example of each of the above for the following languages: C++ Java JavaScript PHP C#

Answers

  1. nido

    On 2006-08-05 02:11:37


    Weak Typing: In computer science, weak typing is a property attributed to the type systems of some programming languages. It is the opposite of strong typing, and consequently the term weak typing has as many different meanings as strong typing does (see strong typing for a list and detailed discussion). One of the more common definitions states that weakly-typed programming languages are those that support either implicit type conversion, ad-hoc polymorphism (also known as overloading) or both. This can give programmers the impression that strict adherence to typing rules is less important than in strongly-typed languages and hence that the type system is "weaker". However, such languages usually have restrictions on what programmers can do with values of a given type; thus it is possible for a weakly-typed language to be type safe. Moreover, weakly-typed languages may be statically typed, in which case overloading is resolved statically and type conversion operations are inserted by the compiler, or dynamically typed, in which case everything is resolved at run time. Weak typing requires less effort of the programmer than strong typing, because the compiler or interpreter will implicitly perform certain value conversions. As a result of this, weakly typed programming systems catch fewer errors at compile time, which can make debugging harder. According to this definition, C and C++ are weakly typed, as they automatically coerce many types e.g. ints and floats.
  2. Dr. Brisbane

    On 2006-08-01 07:13:33


    Why do you take these classes if you can't or don't want to do the work yourself? You're only hurting yourself...when you need to get a job and don't know anything.
  3. Steve S

    On 2006-08-01 07:18:11


    Scripting languages are generally designed to be simple to use for many users online. Weak typing allows less advanced programmers to use the language without worrying as much about type errors. Reducing compile-time errors also allows slightly simpler testing. Often code written in a scripting language must be uploaded to a server to be debugged. Compile-time errors result in there being no output to debug. This is not particularly helpful. Unfortunatly, there is a speed trade off for weakly-typed languages. The compiler or program must figure out what a variable actually is and if it is of a valid type. This is why weak-typing works well for scripting languages where most variables are going to be little more than text and strings.
  4. Coolkama

    On 2006-08-01 07:10:10


    dude, is this a homework question? if so.. remember what you have been taught grasshopper.