Having that, how can I get the 1st ref trace ? Is ...
# haxe
e
Having that, how can I get the 1st ref trace ? Is there a way that Haxe performs "auto casting" ?
Copy code
haxe
abstract Ref<T>(haxe.ds.Vector<Null<T>>) {
    public var val(get, set)    : Null<T>;
    
    inline function new(){
        this = new haxe.ds.Vector( 1 );
    } 
    
    @:to inline function get_val() : Null<T> {
        return this[ 0 ];
    }

    inline function set_val( val : Null<T> ) {
        return this[ 0 ] = val;
    }
    
    @:from static inline public function fromT<T>( val : Null<T> ) {
    trace( "fromT : " + val );
      var ref         = new Ref();
              ref.val    = val;
      return ref;
    }
  }

class Test {
  static function main() {
    var ref        : Ref<Int>    = null;
    var ref2    : Ref<Int>    = (null:Int);    // Only here I get trace
  }
}