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,ce0900b60ca3f616 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-03 16:44:00 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!ppp-1-90.cvx1.telinco.NET!not-for-mail From: "Nick Roberts" Newsgroups: comp.lang.ada Subject: Rosen Trick [List container strawman] Date: Sat, 3 Nov 2001 22:51:26 -0000 Message-ID: <9s230d$107b5a$2@ID-25716.news.dfncis.de> References: <9rti6v$hcu$1@news.huji.ac.il> <1EyE7.10050$xS6.13527@www.newsranger.com> <9rue9f$j4t$1@nh.pace.co.uk> <9ruiet$kqg$1@nh.pace.co.uk> <3BE3235D.E292B890@boeing.com> <3BE35498.9F6381A2@acm.org> NNTP-Posting-Host: ppp-1-90.cvx1.telinco.net (212.1.136.90) X-Trace: fu-berlin.de 1004834638 33795242 212.1.136.90 (16 [25716]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Xref: archiver1.google.com comp.lang.ada:15753 Date: 2001-11-03T22:51:26+00:00 List-Id: I've always felt that this whole charade is an academic Alice-in-Wonderland adventure. The right solution, of course, is to use a procedure (with an in-out parameter) instead of a function. Grrr. PS: Why? Because functions should not have side-effects (in a language like Ada). I don't care about expediencies that are to do with debugging, profiling, auditing, and that sort of thing (where the effort of not using functions would be silly), but where the main thrust of the logic has a side effect, use a procedure! Good programming (in Ada) is not about what weird and funny things you can do that will catch people by surpise (and so be likely to cause bugs, or angst, or both). PPS: I don't think allocating an RNG state block on the heap, rather than the stack, is likely to have much effect on speed; surely the burden of indirect access would be vastly outweighed by the burden of computation for each number generation cycle? And why would using finalisation be inefficient? -- Nick Roberts