Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed10.multikabel.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.026 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'subject:Python': 0.05; 'whichever': 0.07; 'inclined': 0.09; 'bindings': 0.16; 'expression.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; "function's": 0.16; 'parks': 0.16; 'travis': 0.16; 'syntax': 0.16; 'wrote:': 0.18; 'header:In-Reply-To:1': 0.22; 'itself,': 0.23; "i'm": 0.26; 'function': 0.27; 'message- id:@mail.gmail.com': 0.28; 'explicit': 0.29; 'toward': 0.29; 'nov': 0.29; 'pm,': 0.29; 'example': 0.29; 'recursion': 0.30; 'syntax,': 0.30; 'words,': 0.32; 'tue,': 0.32; "can't": 0.32; 'rules': 0.34; 'to:addr:python-list': 0.34; 'languages': 0.35; 'something': 0.35; 'optimization': 0.36; 'but': 0.37; 'run': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'either': 0.39; "it's": 0.40; 'received:209': 0.40; 'to:addr:python.org': 0.40; '2011': 0.61; 'order': 0.62; 'special': 0.68; '29,': 0.73; 'compiles': 0.84; 'recursion.': 0.84; 'subject:Reference': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=t48Z+ty4Ln1vcCBrhUnaRPbAUvnu/O6gWzPfurKiHrg=; b=Ds4WWgevtZUeuHvKEkm50t3DU9jypY0iB89snF+wAOkURCKISJC2ELjV9M6p2XzRE0 OBHI9ym8PkNsRqJ+GTW1zCjHnVq+7w5Lvv/aPfZi8NjezoOcJebWxATLjoAIrftQjiwx W6euIoa9MJXBC1MDQ4X4MWa2eaZe5flStCB0k= MIME-Version: 1.0 In-Reply-To: <861e1820-e70b-4f17-b668-53c4052974f5@w3g2000vbw.googlegroups.com> References: <79379487-0081-4067-92ed-c6717652e1ff@y7g2000vbe.googlegroups.com> <4eb0af60-26b3-45d5-8aff-566505003d6a@m10g2000vbc.googlegroups.com> <4ed2cddc$0$29988$c3e8da3$5496439d@news.astraweb.com> <4ed40a2e$0$29988$c3e8da3$5496439d@news.astraweb.com> <861e1820-e70b-4f17-b668-53c4052974f5@w3g2000vbw.googlegroups.com> Date: Tue, 29 Nov 2011 13:57:32 +1100 Subject: Re: Using the Python Interpreter as a Reference From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1322535454 news.xs4all.nl 6918 [2001:888:2000:d::a6]:51548 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:16370 On Tue, Nov 29, 2011 at 1:42 PM, Travis Parks wrote: > A good example I have run into is recursion. When a local function > calls itself, the name of the function may not be part of scope (non- > local). Languages that support tail-end recursion optimization can't > optimize. In order to support this, a function in Unit will have > access to its own name and type. In other words, special scoping rules > are in place in Unit to allow treating a function as an expression. I'm inclined toward an alternative: explicit recursion. Either a different syntax, or a special-case on the use of the function's own name, but whichever syntax you use, it compiles in a "recurse" opcode. That way, if name bindings change, it's still going to recurse - something few languages guarantee, and therefore few languages can optimize. ChrisA