
A binary coder for Swift - chmaynard
https://www.mikeash.com/pyblog/friday-qa-2017-07-28-a-binary-coder-for-swift.html
======
userbinator
_the numbers are byte-swapped to be endian agnostic_

Regardless of how fast it is, it seems wasteful to do all this byte-swapping
when the vast majority of systems today, outside of more specialised
applications, are little-endian.

~~~
DSMan195276
You can do byte-swapping in one instruction on x86, so it really isn't
something worth worrying about. There aren't many big-endian systems out
there, but it doesn't really matter that much. If you wanted to, you could
change this so it always stores the numbers in little-endian (and does a swap
on big-endian systems) but a lot of the uses of this will likely be for
networking, and people generally expect big-endian in that situation.

~~~
cgb223
> You can do byte-swapping in one instruction on x86

Well considering the vast majority of swift code runs on Apple's ARM chips
(iDevices) rather than x86 processors (Mac), I think that's kind of a moot
point

~~~
mikeash
Moot twice, since ARM also has a single instruction for byte swapping.

------
victor106
How stable are swift releases now? What are some good resources to start
learning swift?

~~~
heifer2822
I think, as a starting place, Apple's Swift Programming Guide is hard to beat

~~~
penpapersw
In my experience, it's difficult to go through because it's so comprehensive
and thorough, and I guess it has to be because it has to assume the lowest
common denominator audience. Personally I'd like a shorter guide that assumes
you know a few languages (C#, ObjC, JS, Java) and skips a bunch of the tedium
of how _programming languages work in general_ and gets right to what's
different about Swift. It may seem like it does that, but look at their page
about control flow[1] and tell me it's not an unreasonably long-winded way of
explaining switch, for, for-in, while, break, continue, and if.

[1]:
[https://developer.apple.com/library/content/documentation/Sw...](https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/ControlFlow.html#//apple_ref/doc/uid/TP40014097-CH9-ID120)

~~~
heifer2822
I agree but Swift is a new enough language that I'm not sure such a resource
exists yet. When I learned Swift I just skimmed through the parts that weren't
interesting and that worked for me. It was a good overview of the language.

As an aside, the book, Advanced Swift, by the objc folks is fantastic but
assumes you already know Swift. It's not what you're looking for, but
something to move onto after you grasp the basics.

~~~
unkown-unknowns
Maybe there is room for a publisher that makes books for people that already
know how to program?

------
pirocks
Interesting how this has 57 points and as of now no comments.

