static-typing

Why does foreach skip compile time type checking on interface types?

When I use a foreach loop in C#, it appears that no compile time type checking is performed if the item type is an interface type. E.g. class SomeClass {} interface SomeInterface {} IEnumerable<SomeClass> stuff; foreach(SomeInterface obj in stuff) { // This compiles - why!? } This will happily compile and cause an exception at runti...

why java number one ?

Why is Java the most used programming language ? Why are the most programmers jobs for Java ? Don't get me wrong here ? I like Java and I work in Java ? I don't have anything against it ? Also, I'm trying to learn some other stuff out of the OOP box, like Clojure with its functional programming. But, I'm wondering, why is Java number...

Using scala to call java.util.Hashtable#put

I've an unexpected trouble calling put on an old-school hashtable. What's going on here? Welcome to Scala version 2.8.0.final (Java HotSpot(TM) Client VM, Java 1.6.0_21). Type in expressions to have them evaluated. Type :help for more information. scala> import com.ibm.mq._ import com.ibm.mq._ scala> MQEnvironment.pro...

How to deal with Python ~ static typing?

I am from Java world and I wonder what is so great about dynamic typing in Python besides missing errors while compiling the code? Do you like Python's typing? Do you have an example where it helped in a big project? Isn't it a bit error prone? ...

Type casting error and constructor

I have two classes public class A { public A() { } } public class B:A { public B() { } } and it the code in Main is as follows A oa = new B(); B ob = new A(); Here line 1 compiles successfully while line 2 displays typecasting error. Why this happens. ...

How does Python's lack of static typing affect maintainability and extensibility in larger projects?

After reading this very informative (albeit somewhat argumentative) question I would like to know your experience with programming large projects with Python. Do things become un manageable as the project becomes larger? This concern is one thing that keeps me attached to Java. I would therefore be particularly interested in informed ...

Disadvantages of Scala type system versus Haskell?

I have read that Scala's type system is weakened by Java interoperability and therefore cannot perform some of the same powers as Haskell's type system. Is this true? Is the weakness because of type erasure, or am I wrong in every way? Is this difference the reason that Scala has no typeclasses? ...

Cannot create apply function with static language?

I have read that with a statically typed language like Scala or Haskell there is no way to create or provide a Lisp apply function: (apply #'+ (list 1 2 3)) => 6 or maybe (apply #'list '(list :foo 1 2 "bar")) => (:FOO 1 2 "bar") (apply #'nth (list 1 '(1 2 3))) => 2 Is this a truth? ...

What prevents a statically typed language from having something like Ruby's method_missing?

I don't have much experience with statically typed languages (currently learning Scala and loving it!) but one thing I've noticed is that they don't ever seem to have anything like Ruby's method_missing or ColdFusion's onMissingMethod. Is there some inherent limitation in statically typed languages that prevent or make this difficult? ...

How do statically-typed languages deal without generics?

I'm curious which statically-typed languages have no generics support (and to a lesser extent which languages historically did not have generics), and how they deal with it. Do users just cast all over the place? Is there some special sauce for basic collections, like lists and dictionaries, that allow those types to be generic? Why ...

Explicitly statically typed programming langagues.

Hi, I am curious. I am interested in knowing if any languages exist like C++ and Java, in that the langauge is: (a) Explicitly (ie. not by inference) statically typed, (b) Object Oriented. I am aware of D, but what others are people using? Cheers ...