Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.022 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'static': 0.04; 'string': 0.09; 'feature.': 0.09; 'type,': 0.09; 'cc:addr:python-list': 0.11; 'declaration': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; "function's": 0.16; 'iterators,': 0.16; 'keyword.': 0.16; 'subject:programming': 0.16; 'syntactic': 0.16; 'language': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'value.': 0.19; 'examples': 0.20; 'cc:addr:python.org': 0.22; 'instance,': 0.24; 'integer': 0.24; 'pointer': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'characters': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'usually': 0.31; 'obliged': 0.31; 'this.': 0.32; 'agree': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'c++': 0.36; 'var': 0.36; 'useful': 0.36; 'too': 0.37; 'implement': 0.38; 'pm,': 0.38; 'skip:u 10': 0.60; "you're": 0.61; 'real': 0.63; 'such': 0.63; 'provide': 0.64; 'more': 0.64; 'mar': 0.68; 'felt': 0.74; 'assertion.': 0.84; 'working,': 0.84; 'adopt': 0.91; 'dozen': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=n4VZfp3G/jC4YFsSBYaV6LmNrB4voD4YdcHGvw6YMIc=; b=iDUZYmhWgDF6IJktw906q8nJuFWg34QikLn2Cn0R0FgI5VXZWseqfEHk/k6LgemjHx HIgrQpl7Ez4X9jpVUN/0Isn5hCZr2ta+ZngwBNBWONQsPrPDwfOwDhfWHHzGrFqdMWdO gZnpwRu0JZrD40QeaJtdgyrO9Ao5a1BiwOzH2R2s8vj9ueOtmBxFXpDLICs9qv5X/TR1 MGgGhfMc8jyop5vM9jnPEVzDkMCy9wlFr7R+x4FTp8oVXAa6FFV9ESANuP9oVVSS+PKD 9cFPCPaxV8Aw5H+29gNLQdwIMmEIKycb703HPJG+9jgQwyiz6r3HRtdtK3zL2jv/71HV 8iSQ== MIME-Version: 1.0 X-Received: by 10.68.248.7 with SMTP id yi7mr6416826pbc.31.1394021060826; Wed, 05 Mar 2014 04:04:20 -0800 (PST) In-Reply-To: References: <4c7dbc57-eef9-4582-aecd-aac13a39b45f@googlegroups.com> <3b54a279-03a1-4a81-a428-ecad6eb16036@googlegroups.com> <216bb5f4-32c4-4f86-a9f4-1b0dd37a2a81@googlegroups.com> <0129a5b9-b85f-4ad5-b5e2-bfb2a48041d5@googlegroups.com> <5314bb96$0$29985$c3e8da3$5496439d@news.astraweb.com> <5315661c$0$2923$c3e8da3$76491128@news.astraweb.com> <53159540$0$2923$c3e8da3$76491128@news.astraweb.com> <5315eec0$0$29985$c3e8da3$5496439d@news.astraweb.com> Date: Wed, 5 Mar 2014 23:04:20 +1100 Subject: Re: Functional programming From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394021064 news.xs4all.nl 2901 [2001:888:2000:d::a6]:35971 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67835 On Wed, Mar 5, 2014 at 10:28 PM, BartC wrote: > But I agree that in many cases, an initialised declaration *could* often be > used to infer the likely type without too much trouble: > > var x=2 # integer > var y=3.0 # real > var z="A" # probably, a C-style string pointer ('char*') > > (And since I'm working on such a language at the moment, I felt obliged to > implement exactly this. And yes, with 10 minutes' effort, something like > this was working, to prove my assertion. > > However it is not satisfactory, which is one reason why no well-established > static language is likely to adopt such a feature. It is just too untidy, > too ad-hoc and undisciplined, to say that usually you need to provide an > exact type, but sometimes, in such and such an instance, you don't need to > bother!) C++ has something very like this, with the 'auto' keyword. It's not particularly useful for the examples you give, but can be much more so when you have templates, iterators, and so on - where the exact type declaration might be a couple dozen characters of pure syntactic salt, since you're initializing it to some function's return value. ChrisA