Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
cballard
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
25 ms
·
211.
▲
by
cballard
11y ago
When that happens, try adding type signatures to any closures that are currently using inferred types. It often fixes it.
212.
▲
by
cballard
11y ago
> This has been sorely needed since about day one of Swift development, glad to see that it's been a priority as part of the effort to open source! While not first-party, https://github.com/Carthage/Carthage Sw
213.
▲
by
cballard
11y ago
Yes, of course, I use constants in all cases. Why is adding 1 to something special, compared to adding 2 to something? The #1 use case, by far, is C-style for loops, which aren't used in idiomatic Swift code.
214.
▲
by
cballard
11y ago
This operator was popularized by C, so comparisons with C make sense. Of course you wouldn't remove pointers from C, the language would barely work if you did. Confusing C-isms like pointers are what Swift is trying to get away from. T
215.
▲
by
cballard
11y ago
In a high-level language, this is the job of the compiler, though. If the compiler isn't generating those instructions for cases where the increment can be proven to be 1, I would consider it a bug.
216.
▲
by
cballard
11y ago
Yes! And local "var". The optimizations that "var" allows should be the job of the compiler. It's still needed at the non-local level on reference types, but could possibly be disallowed in structs as well.
217.
▲
by
cballard
11y ago
Sorry, you are correct - although I would restate my point with "+= 1" isn't special. 1 is just another number, the fact that it's useful for enumerating arrays in C isn't relevant as Swift provides more native solu
218.
▲
by
cballard
11y ago
Yes - or in the Apple ecosystem, method swizzling is incredibly useful but also incredibly harmful - both to performance through necessitating dynamic dispatch, and to confusion, because WTF, method swizzling?
219.
▲
by
cballard
11y ago
Apple has a long history of readability over terseness. "plus plus" doesn't mean anything. It might even be confusing that it doesn't add 2 .
220.
▲
by
cballard
11y ago
Making the language difficult for advanced developers to abuse is practically an explicit goal of Swift. I mean, its predecessor allowed you to mutate your class hierarchy at runtime , and this was a thing that people commonly did! "Y
221.
▲
by
cballard
11y ago
C-style for loops are discouraged in good Swift code. Use map, ranges, or for/in instead.
222.
▲
by
cballard
11y ago
Yes. Anointing "+ 1" as a thing that needs special syntax is weird .
223.
▲
by
cballard
11y ago
Those exist, as part of "RandomAccessIndexType", to which "Int" conforms: 1.advancedBy(1) == 2 This is different than ++, though, because ++ mutates the value, and advancedBy(:) returns a new one.
224.
▲
by
cballard
11y ago
Well, the same argument can be made for pointers, which are clearly harmful to a safe language. Swift does include them, but puts a screaming "Unsafe" in front of their type names so that it's clear that unless you really kno
225.
▲
by
cballard
11y ago
While 4 touches on this a bit, I think another reason is that mutable value types are generally harmful. Save mutability for compiler optimizations and write your code with "let".
226.
▲
by
cballard
11y ago
Because non-advanced users will incorrectly abuse them. That's why ARC doesn't let you call retain and release manually, even though there's no technical reason it couldn't.
227.
▲
by
cballard
11y ago
Objective-C bridges to and from Swift easily, so it would be easily to incrementally replace Objective-C code with Swift code. Since C++ doesn't interact with Swift at all, it would either have to be wrapped in C/Objective-C, or t
228.
▲
by
cballard
11y ago
> Sometimes a programming design pattern becomes common enough to warrant its own special syntax. Python’s list comprehensions are a prime example of such a syntactic sugar. I disagree with this thesis, although the post is otherwise a v
229.
▲
by
cballard
11y ago
Why haven't more liberal/agile (no, not Agile) companies beaten these companies? That their policies are harmful seems to be considered a fact, so a company without those policies could be much more productive.
230.
▲
by
cballard
11y ago
That isn't logically inconsistent, i.e. "if you don't want things associated with your name forever, don't put them on the internet under your name". If someone posts racist bile under a pseudonym, it also won'
231.
▲
by
cballard
11y ago
See also (in the other direction?): #mynypd https://www.washingtonpost.com/news/post-nation/wp/2014/04/2...
232.
▲
by
cballard
11y ago
Why isn't Haskell, or any other functional language, popular for this sort of thing? Turning A into B is what FP excels at, and you shouldn't have to reason about side effects, besides writing the graph images somewhere. From what
233.
▲
by
cballard
11y ago
Right, that's why I said the only thing I use is the Netflix app. Substitute with Hulu, iTunes, Amazon Prime (err, well, not that one), etc. for the service that you use.
234.
▲
by
cballard
11y ago
Yeah, the Apple Notes app is a perfectly sufficient app for making most lists, and it automatically syncs to all of your devices. That's just one fantastic free option.
235.
▲
by
cballard
11y ago
I have an Apple TV (dev kit, I wouldn't have paid for one, but it's pretty nice actually). I haven't used a single app besides Netflix and AirPlay (which isn't really an app), and I'm not even sure why I'd want
236.
▲
by
cballard
11y ago
The idea of those things being built in a language without memory and good type safety (no ability to cast everything to void*) should terrify you.
237.
▲
by
cballard
11y ago
Casual Friday seems like an absurd concept to me. Either you're capable of getting the job done in denim, or you're not. If you cannot, why would you be allowed to wear them on Friday? If you can, why wouldn't you be able to
238.
▲
by
cballard
11y ago
> They care a lot about being around people that care about dress, and turning up in a suit is a very reliable indicator that a person cares about dress. I disagree with this. Showing up in "a suit", in most cases, isn't c
239.
▲
by
cballard
11y ago
I will always use Apple Pay if available, since it prevents tracking by evil merchants and leaks by hackers via unique credit card numbers. I do not understand why the US uses these terrible chip and signature cards, which were a repeated s
240.
▲
by
cballard
11y ago
I feel like there is a conflation here of dressing casually[1] and dressing like a slob[2]. The former understands silhouette, color (often lack thereof), texture, etc., but eschews traditional formal attire. > The only thing I will say
More ›