loose-typing

PHP loose typing in while loop comparison

Given the following code snippet: $i= 11; function get_num() { global $i; return (--$i >= 0) ? $i : false; } while($num = get_num()) { echo "Number: $num\n"; } Results in the following output: Number: 10 Number: 9 Number: 8 Number: 7 Number: 6 Number: 5 Number: 4 Number: 3 Number: 2 Number: 1 However, I also w...

Java Best Practice for type resolution at runtime.

I'm trying to define a class (or set of classes which implement the same interface) that will behave as a loosely typed object (like JavaScript). They can hold any sort of data and operations on them depend on the underlying type. I have it working in three different ways but none seem ideal. These test versions only allow strings and i...

ASP.Net layered communication

Hi, We're developing a layered web application. The specs: 3 layers, data layer, business layer, ui layer. Programmed in C# Data Layer uses the entity framework Currently we plan on having the data layer return IEnumerable<T> to the business layer via linq 2 entities, and the business layer will return data to the ui layer. Sinc...

PHP: Code checker since PHP is a loose type / dynamic language?

I have a small PHP web-based application that is beginning to grow moderately in size. I'm starting to become concerned with managing my PHP code base, given PHP is a loosely/weak typed, dynamic language. How do others manage their code based for loosely/weak typed, dynamic languages? Do pre-parsers exist for PHP that allow me to runs...

Strict vs loose typing when overriding a method

I have a class called AddressCard from an example in "Programming in Objective C", and I'm implementing a isEqual: method. The signature of this method in NSObject uses loose typing for the parameter: - (BOOL)isEqual:(id)anObject OTOH, the sample code in the book uses strict typing: - (BOOL) isEqual:(AddressCard *) aCard I'm not s...