OT: This Swift thing
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sat Jun 7 00:57:19 EDT 2014
On Fri, 06 Jun 2014 20:41:09 -0600, Michael Torrie wrote:
> On 06/06/2014 12:28 AM, Travis Griggs wrote:
>>
>>
>>> On Jun 5, 2014, at 1:14, Alain Ketterlin <alain at dpt-info.u-strasbg.fr>
>>> wrote:
>>>
>>> Swift's memory management is similar to python's (ref. counting).
>>> Which makes me think that a subset of python with the same type safety
>>> would be an instant success.
>>
>> Except that while you don't need to regularly worry about cycles in
>> python, you do in swift. Which means you get to think constantly about
>> direct and indirect cycles, figure out where to put weak stuff, when to
>> use a local to keep a weak property alive until it finds it's strong
>> home, etc.
>
> Swift's reference counting seems to be fairly close to Objective C's,
> which makes sense since the classes can be used directly in Swift. Seems
> to me that Swift is just Objective C with some syntactic sugar and a
> nicer syntax. That's why I said it was a little odd to be comparing
> Swift to Python, or at least to be claiming Apple should have made
> Python it's core language.
A "little" odd? It's utterly astonishing!
Swift is not in the same family of languages as Python, Perl, Javascript,
Ruby, Applescript, etc. I'll call them "scripting languages", but I don't
mean that as a put-down. I just mean that they are intended for rapid
development, they are dynamically typed, lightweight, and typically
aren't expected to compile directly to machine code.
Swift is intended as a new generation *systems language*. The old
generation of systems languages are things like C, Objective-C, C#, C++,
Java, Pascal, Algol, and so forth. The new generation are intended to
fulfil the same niches, but to have syntax and usability closer to that
of scripting languages. Languages like Go, Rust, Ceylon, and now Swift.
We're starting to see the distinction between systems and scripting
languages blurred even more than it used to be. These smart, lightweight
but powerful systems languages are likely to be a big challenge to
scripting languages like Python and Ruby in the coming decades. If you
had a language as easy to use and as safe as Python, but as efficient as
C, why wouldn't you use it?
It is naive to expect Apple to have made Python it's core language.
Apple's core language is Objective-C, and if they were going to pick a
core scripting language (other than Applescript, which exists in a
different ecological niche) it would have been Ruby, not Python. Ruby's
fundamental model is very similar to Objective-C, Python's is not. Apple
already developed a version of Ruby, "MacRuby", which was designed to
call directly into the Objective-C APIs without an intermediate interface
layer, but they have abandoned that to focus on Swift.
(Besides, Apple is unlikely to commit to a core language being something
they don't control.)
--
Steven D'Aprano
http://import-that.dreamwidth.org/
More information about the Python-list
mailing list