2

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?
prash
  • 324
  • 3
  • 14
  • I realize my explanation and example above may not make much sense to someone who does not know Oz, even if this concept is implemented in the languages they know. But it would be tedious for me to elaborate on the concept, as it would require me to explain the entire subsection of that chapter. – prash Nov 21 '20 at 22:01

0 Answers0