PreviousUpNext

15.3.514  src/lib/std/src/nj/weak-reference.api

## weak-reference.api
#
# Weak references provide access to a value while
# still allowing it to be garbage collected.
#
# A  typical application is to keep an index of all
# existing values of a particular sort (say, open
# X windows connections), while still allowing old
# values to be garbe-collected normally.
#
# The penalty for using a weak reference is that
# any access to its value may return NULL due to
# the underlying value having been garbage-collected.
#
# For production uses of this, see:
#
#     src/lib/src/finalize-g.pkg
#     src/lib/compiler/back/top/highcode/highcode-uniq-types.pkg
#     src/lib/x-kit/style/widget-style-g.pkg

# Compiled by:
#     src/lib/std/src/standard-core.sublib


api Weak_Reference {
    #
    Weak_Reference(X);

    make_weak_reference:    X -> Weak_Reference(X);

    get_normal_reference_from_weak_reference
        :
        Weak_Reference(X) -> Null_Or(X);

    Weak_Reference';

    make_weak_reference' : X -> Weak_Reference';

    get_normal_reference_from_weak_reference'
        :
        Weak_Reference' -> Bool;
};



## COPYRIGHT (c) 1995 AT&T Bell Laboratories.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext