From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,99f33f51845a7793 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-07 10:59:38 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!news1.rdc1.sfba.home.com.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: 'withing' problem References: <3be907bc$0$233$ed9e5944@reading.news.pipex.net> X-Newsreader: Tom's custom newsreader Message-ID: Date: Wed, 07 Nov 2001 18:59:38 GMT NNTP-Posting-Host: 24.7.82.199 X-Complaints-To: abuse@home.net X-Trace: news1.rdc1.sfba.home.com 1005159578 24.7.82.199 (Wed, 07 Nov 2001 10:59:38 PST) NNTP-Posting-Date: Wed, 07 Nov 2001 10:59:38 PST Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: archiver1.google.com comp.lang.ada:16007 Date: 2001-11-07T18:59:38+00:00 List-Id: > The implementation of 'print' would call 'toString(x)' and output the result. I thought toString might be intended for that, but then I'd expect it to return a fixed type like String, not some extendable (ie, variable) type "seq". > Correct. But the declaration of 'toString' needs to be in the package for > 'anything', so the package for 'anything' needs to 'with' the package for > 'seq', and vice versa. > > function toString(x:anything'class) return seq; If toString takes "anything'class", then it's not a primitive of "anything" and needn't be declared in the same package as "anything". In particular, "toString" and "seq" can be declared together in a package that with's the package that declares "anything". package Root_Of_All is type anything is tagged null record; ... end Root_Of_All; with Root_Of_All; package Debugging_Help is type seq is new anything with record ... end record; function toString(x:Root_Of_All.anything'class) return seq; -- yields "unprintable object" as seq -- Should be overloaded for printable objects ... end Debugging_Help; with Root_Of_All, Debugging_Help; package Something is type heir is new ... --- descendent of "anything" function toString(x:heir'class) return seq; -- seq is suitable for printing for debugging or whatever ...