Re: Man or boy test (was: Fair comparison C vs HLASM)
PL/I has procedure parameters but not call by name. Algol 60 has call by name but not call by reference. -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 From: IBM Mainframe Assembler List <ASSEMBLER-LIST@listserv.uga.edu> on behalf of Paul Gilmartin <0014e0e4a59b-dmarc-requ...@listserv.uga.edu> Sent: Thursday, February 8, 2018 12:21 PM To: ASSEMBLER-LIST@listserv.uga.edu Subject: Re: Man or boy test (was: Fair comparison C vs HLASM) On 2018-02-08, at 08:33:37, Bernd Oppolzer wrote: > Am 08.02.2018 um 15:50 schrieb Martin Ward: >> >> >> http://secure-web.cisco.com/1BYQst4tMUhn0OQV9yNTQIFppybJ0w91dgsHZtHRZ5OFG6Jn7aOxSsU9PWIni4HyW0_5nVh8ZG20CX03I9-CEemCEbfFfvX2hj94e9K4OMYtvDf_f10ZgJrOMgpJ47JzGzwUie1fk2lT0JfNN-vLwXwOD257QnOeUAdmdaseSBIixhOXR4hToYn3d2AmQEfStBhSzKukmFQI0tys2gU9ZNYnl5NQAeCGPVja-FALuxbVms22hjzw3weIpjyN4iS_D7qbDDRxUUWUkUYCawxU5GVQrAXQ2VGCQkqPkZQYc18DyNXRwjBX1Oxp98pyV-uco8V1CPXxOc1COft5oePt9ZPN_vRhNS4d3RUSZAflwS78yJ2I_-u6rH_g_VX0rHENZQ1S7r6hY7caV5wJBZxnr0A/http%3A%2F%2Frosettacode.org%2Fwiki%2FMan_or_boy_test >> > I would like to thank you very much for posting this. > I never heard about this test before, but I am very fascinated by it, > and I will try it out in the next days on my New Stanford Pascal compiler, > as soon as I have time to do it (there is a Pascal version of the test > on the page you mentioned above). > I glanced very briefly at it. It depends on nested procedure declarations which C lacks (and call-by-name? which Pascal lacks). PL/I? I think nested procedures were an early manifestation of OO-think: a block is an object and procedures within it are methods. Languages such as C eschew nested procedures partly because a procedure descriptor must consist of two pointers rather than just one. I vaguely remember one compiler (but I think it was C) that did this with an extra indirection: a procedure reference actually pointed to a structure containing two pointers, one for the entry point and the other for the stack frame. Broke a lot of things, especially expectation of portability. -- gil
Re: Man or boy test (was: Fair comparison C vs HLASM)
On 2018-02-08, at 08:33:37, Bernd Oppolzer wrote: > Am 08.02.2018 um 15:50 schrieb Martin Ward: >> >> >> http://rosettacode.org/wiki/Man_or_boy_test >> > I would like to thank you very much for posting this. > I never heard about this test before, but I am very fascinated by it, > and I will try it out in the next days on my New Stanford Pascal compiler, > as soon as I have time to do it (there is a Pascal version of the test > on the page you mentioned above). > I glanced very briefly at it. It depends on nested procedure declarations which C lacks (and call-by-name? which Pascal lacks). PL/I? I think nested procedures were an early manifestation of OO-think: a block is an object and procedures within it are methods. Languages such as C eschew nested procedures partly because a procedure descriptor must consist of two pointers rather than just one. I vaguely remember one compiler (but I think it was C) that did this with an extra indirection: a procedure reference actually pointed to a structure containing two pointers, one for the entry point and the other for the stack frame. Broke a lot of things, especially expectation of portability. -- gil
Re: Man or boy test (was: Fair comparison C vs HLASM)
Am 08.02.2018 um 15:50 schrieb Martin Ward: On 08/02/18 14:29, Jon Perryman wrote: knowing full well I wouldn't waste my time learning a language that is irrelevant to me. I'm not sure why you think I am asking you to learn a new language. If you are not sure what the Algol 60 code for the "man or boy test" actually does, and (not unreasonably) don't want to have to learn Algol 60 to find out, then there are implementations of the test in 72 other languages (including C and C++) on the Rosetta Code page: http://rosettacode.org/wiki/Man_or_boy_test I would like to thank you very much for posting this. I never heard about this test before, but I am very fascinated by it, and I will try it out in the next days on my New Stanford Pascal compiler, as soon as I have time to do it (there is a Pascal version of the test on the page you mentioned above). BTW: I didn't make any changes to the Stanford compiler with respect to function and procedure parameters, so it should work the same way as it did in the 1979 version. The Stanford compiler is a descendant of Wirth's P4 compiler. I will tell you about the results. Thanks again, kind regards Bernd