Twitter | Search | |
Rob Napier
Swift and Go. Love 'em both. They make me mad in completely different ways. Infosec as required.
11,842
Tweets
310
Following
5,423
Followers
Tweets
Rob Napier retweeted
Darian Moody 2h
"Line of sight" is such a beautiful way to describe why "flat is better than nested" is so important in terms of code readability. Great read from .
Reply Retweet Like
Rob Napier 11h
Replying to @schwa
That 48.8% number… yeah, we survived another day.
Reply Retweet Like
Rob Napier 11h
I think this is mostly Cocoa history though. CGFloat is a funny animal for Swift.
Reply Retweet Like
Rob Napier 13h
So like `.pi` but without having to declare the extension?
Reply Retweet Like
Rob Napier 15h
Replying to @GeekAndDad @gregtitus
I've often said that if we knew today what we knew in 1980, we'd be a lot further ahead. The fact that Dijkstra and Liskov and Backus and … were all complaining about the same things decades ago that we're complaining about now says a lot about our industry.
Reply Retweet Like
Rob Napier 15h
Replying to @GeekAndDad @gregtitus
Heh… IMO the problem with indirect dispatch isn't the cost of the dispatch nearly as it's the opportunity cost of further optimizations. Those things like "can't the compiler just work out what values could occur" that we were talking about? Impossible w/ runtime dynamics.
Reply Retweet Like
Rob Napier 15h
Replying to @gregtitus @GeekAndDad
And heap allocation is probably more expensive now than it was then given multi-threading, etc.
Reply Retweet Like
Rob Napier 15h
Replying to @GeekAndDad
A good lesson is to go back and really try using some of those old "amazing" systems and see if you'd really be happy giving up your current system for them. Or if…you know…a "few" more features… :D
Reply Retweet Like
Rob Napier 15h
Replying to @GeekAndDad
Easier to analyze if all the values come from inside the program. But many values come from outside the program, and we generally just use "I'm sure that wouldn't happen" to manage those.
Reply Retweet Like
Rob Napier 15h
Replying to @GeekAndDad
But we didn't expect super-fancy animations at high resolutions with multi-touch dragging in 1980, either. We've already eaten up a lot of that performance in features.
Reply Retweet Like
Rob Napier 15h
Replying to @GeekAndDad
That said, the mind-bending bugs aren't about getting integers out of range. The mind-bending bugs come from the fact that Int is not a subset of Double, and there are many Doubles for which "x + 1 == x". Assuming "that will never happen" is the source of many tears.
Reply Retweet Like
Rob Napier 15h
Replying to @GeekAndDad
75% of the issue is in that "if a bit slowly." The other 25% is in the "and eating al ot of memory."
Reply Retweet Like
Rob Napier 15h
Replying to @GeekAndDad
How can the compiler know the range of variable over all possible inputs? In my experience, developers often just rely on hope that it'll never be outside a reasonable range (like "I know this comes from the screen size, and that won't be bigger than…").
Reply Retweet Like
Rob Napier 15h
Replying to @JoshuaNozzi
Reply Retweet Like
Rob Napier 15h
Replying to @cocoaphony
I really do like ObjC, and Swift has about a thousand problems, but every time I come back to ObjC, within a couple of hours I'm ready to get back to Swift.
Reply Retweet Like
Rob Napier 16h
I'm getting sloppy in my Swift-dottage. Forgot that XCTAssertEqual(object, object) doesn't do what you think it does in ObjC.
Reply Retweet Like
Rob Napier 16h
Replying to @GeekAndDad
BTW, this is the reason crypto folks love Python so much. It's a glorious language for saying things like `x = 123...600 digits...890`. But when you want any performance out of your math, you have to pull in numpy. (That said, it's a nice tradeoff in Python.)
Reply Retweet Like
Rob Napier 16h
Replying to @GeekAndDad
That's an argument for the default numeric type being BigInt (and eating the performance issues that go with that). As long as a language exposes "has to fit in a register" as part of the definition of its numeric types, we'll have to worry about that detail.
Reply Retweet Like
Rob Napier 16h
Replying to @GeekAndDad
That said, I'm not saying it's a clear choice (particularly Float/Double and even more-so CGFloat… that horror of Swift). But Int/Double does cause bugs that are really nasty; just not every day.
Reply Retweet Like
Rob Napier 16h
Replying to @GeekAndDad
If by "fine" you mean in 95% of the cases, yes. But when you encounter promotion bugs in C, they are horrific & hard to predict or find. I'll buy "you'll probably only encounter them a few times in your career if you mostly work at the UI layer," but it's a choice.
Reply Retweet Like