

How Swift is Swift? - astigsen
http://realm.io/news/swift-summit-joseph-lord-performance/

======
saidajigumi
> With most classes, unless you design them really carefully, your methods are
> often at risk from being overridden by others in ways that don’t meet
> expectations — especially if it mutates the object and does so in a
> different way.

WAT. Because Ruby and Python programmers are just bleeding to death from the
thousand cuts of overriding methods during subclassing. Or... not?

More seriously, is there something to Swift here that I'm missing? Because in
just about any language I've run across with inheritance, either the
superclass(es) are part of a framework that defines a protocol for the
inheriting code (e.g. you may/must provide methods X, Y, and Z. These methods
must behave according to the following rules {...}), or else the programmer
writing the inheriting code takes on the full responsibility of integration.

~~~
micv
Anyone who inherits from a class and accidentally overrides a method is a
hopeless case or a newbie needing basic review from a senior dev. The bugs are
on them. They can either test that their inheritence works, learn from the
mistake, or they can piss off and find a new career emptying bins, flipping
burgers, or whatever they fancy that doesn't involve making sure that what
they just did will work beyond the immediate function.

~~~
overgard
> Anyone who inherits from a class and accidentally overrides a method is a
> hopeless case or a newbie needing basic review from a senior dev

That's a pretty harsh stance. I don't mean to be a jerk, but how much
professional experience do you have? Even in good code bases there are
frequently complicated hierarchies with non-obvious dependencies that are very
easy to screw up even by people who know what they're doing. Good teams find
ways of automating the checking on these things so that they can spend their
time thinking about other problems, or avoiding the complication altogether,
rather than blaming the victim.

~~~
micv
I'm a decade in. I know what you mean about complex hierachies, but
inheritence is a very, very dangerous tool; you either take the time to review
the results, or you suffer the consequences. That's where the review by senior
developers comes in. You learn or you don't. Who would want to work with devs
who don't?

~~~
Jweb_Guru
I do, because I don't consider people's ability to deal with the vagaries of
inheritance a valuable skill when you can just avoid it with effectively no
negative consequences.

Of course, to clarify, it's not really possible to avoid in languages like
Java, where it is more or less mandatory due to the design of its standard
library (unless you avoid that too, which is a considerably worse idea), but
you can still keep your own CODE clean with liberal use of `final` and
interfaces.

Personally, I'm consistently baffled when programmers like yourself, who have
come to appreciate that "inheritence [sic] is a very, very dangerous tool,"
continue to defend it so vigorously. If it offered really powerful or unique
advantages, sure--but if you take a hard at what it actually provides, it's
just syntactic sugar and a performance "optimization" (thin pointers) that's
usually pessimal compared to other approaches. The downsides are significant
and well-known (as mentioned above, Liskov substitution being undecidable is
one consequence, but there are plenty of others). There's no point in making
life harder for ourselves.

------
josephlord
Speaker here, a little late to the conversation though. Let me know if there
are any particular questions, I'll read through everything later and respond.

------
zyxley
> Exactly how Swift is Swift?

Adjectives shouldn't be capitalized.

~~~
MBCook
In this case it's Title Case though.

~~~
dragonwriter
Title Case is an Abomination that Obscures the Meaning Imparted by Differences
in Capitalization in the English Language.

------
nn3
>Function calls are really slow

Really? How can you design a new language with such a problem? It's not the
80ies anymore.

~~~
M8
Apple is not a software company, they should focus on hardware.

~~~
demallien
I was just going to down vote you, that's all trolling deserves on HN, but on
the off chance that you're just ignorant, and not actually trolling:

1) there are 5 OSes with more than 100million users. Apple makes two of them
2) there are 4 major web browsers out there, apple makes one of them 3) there
are 3 major office suites out there, Apple makes one of them

Apple is one of the biggest software companies in the world. I suspect they
are second only to Microsoft in that regard, and yes, I do include Google in
that assessment.

------
MichaelCrawford
He had a price put on his head by the British Crown.

