class Test {
    static function main() {
        trace("Length of a String: " + length("Hello world"));
        trace("Length of an Array: " + length([0, 3, 5, 2, 1]));
        //trace("This will throw a compile time error: " + length(3));
    }
    
    static inline function length<T:{var length(default, null):Int;}>(o:T) {
        return o.length;
    }
}