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.2 required=5.0 tests=BAYES_00,FROM_LOCAL_HEX, FROM_STARTS_WITH_NUMS autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,de7dd126d6737f3a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Vinzent Hoefler" <0439279208b62c95f1880bf0f8776eeb@t-domaingrabbing.de> Newsgroups: comp.lang.ada Subject: Re: Callback in Ada Date: Sat, 27 Nov 2010 12:04:56 +0100 Message-ID: References: <8lc2d0Fb6jU1@mid.individual.net> <87bp5boylc.fsf@ludovic-brenta.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Trace: individual.net t8bMS6+8kQI59rIHV7xtcgz4ni5pbQTEXAXFb803rafQgmu+gh Cancel-Lock: sha1:aJX3vH3C7PCB1DZ6Jfd2Hvm7lac= User-Agent: Opera Mail/10.63 (Win32) Xref: g2news1.google.com comp.lang.ada:15677 Date: 2010-11-27T12:04:56+01:00 List-Id: Ludovic Brenta wrote: > This function "apply_to" is a classic example of a "passive iterator". > > This example is not type-safe; apply_to assumes that function takes > exactly one argument and returns exactly one result. What happens if > you pass a function that takes zero or two arguments? Then the interpreter tells you something along the lines "function expects exactly one argument, but two given." > Or if it does not return anything? Then it will be of the "None"-type. This is Python, not Perl. ;) Of course, just like in every dynamically typed language, it crashes at run-time, not at compile-time. Vinzent. -- Beaten by the odds since 1974.