HH\Lib\Ref

Meta Engineer?

This is available as Ref in the www repository.

Wrapper class for getting object (byref) semantics for a value type

This is especially useful for mutating values outside of a lambda's scope.

In general, it's preferable to refactor to use return values or inout parameters instead of using this class - however, a Ref of a Hack array is generally preferable to a Hack collection - e.g. prefer Ref<vec<T>> over Vector<T>.

C\reduce() and C\reduce_with_key() can also be used in some situations to avoid this class.

Interface Synopsis

namespace HH\Lib;

final class Ref {...}

Public Methods