What production-ready programming languages have something analogous to `NewName` of Mozart/Oz?

112 views Asked by At

Section 3.7.5 of CTM introduces the NewName concept for data encapsulation in secure abstract data types. It is meant to be used in this manner:

proc {NewWrapper ?Wrap ?Unwrap}
    Key={NewName}
in
    fun {Wrap X}
        fun {$ K} if K==Key then X end end
    end
    fun {Unwrap W}
        {W Key}
    end
end
local Wrap Unwrap in
    % This part uses the above definitions to implement a secure stack
    {NewWrapper Wrap Unwrap}
    fun {NewStack} {Wrap nil} end
    fun {Push S E} {Wrap E|{Unwrap S}} end
    fun {Pop S E}
        case {Unwrap S} of X|S1 then E=X {Wrap S1} end
    end
    fun {IsEmpty S} {Unwrap S}==nil end
end

I could not find the proper technical term for this NewName concept. So I'd like to know:

  1. What is this concept called outside of Mozart/Oz?
  2. Which of the more mainstream languages implement this mechanism?
0

There are 0 answers