Better HN
topnewbestaskshowjobs
Log inSign up

hellofunk

9,428 karma · joined Jul 10, 2015 (11y ago) · 3,276 submissions

John Bellick, Mexico City
Submissions

comment 10y ago · link · parent

Except in swift, a truly value-oriented thought process is hampered by its copy-on-write semantics, which are a far cry from immutable structures found in functional languages.

comment 10y ago · link · parent

I have yet to encounter any problem that would be better served with an imperative for loop or nested for loop than an immutable list comprehension in Clojure, for instance.

comment 10y ago · link · parent

Anytime I see someone claim that immutability is "less useful" than mutability, I know that the individual has not spent a long time working in an immutable language. Because things are tremendously easier when mutation rarely enters the picture. But, it can take some experience to grasp this.

comment 10y ago · link · parent

I've read a number of articles like this one regarding the Integer protocol in Swift and the many different int types:

http://blog.krzyzanowskim.com/2015/03/01/swift_madness_of_ge...

I guess everyone's mileage varies, but I find it a bit strange.

comment 10y ago · link · parent

What about stuff like this, these weird castings that pop up in Swift that you don't worry about in Objective-C when dealing with C APIs:

glBindBuffer(GLenum(GL_ARRAY_BUFFER), bufferIds[1])

glBufferData(GLenum(GL_ARRAY_BUFFER), sizeof(Float) * tcSize, tc, GLenum(GL_STATIC_DRAW))

That just looks silly to me.

comment 10y ago · link · parent

Your 4 stages are right on. I've been through all 4 and can say you hit the nail on the head.

And thanks for calling me "englightened." :)

comment 10y ago · link · parent

This underscores the notion that functional programming is ultimately about immutability, and all the idioms expected by a truly functional language are really a result of how it handles state more than anything. A closure is usually expected to close over values, and the idea of a "variable" doesn't really mean the same in a truly functional language, which is where all the confusion and the pain points stem from.

comment 10y ago · link · parent

The problem is that closures don't usually refer to mutable entities, and most functional programmers are used to an immutable language. The idea that a closure itself is mutated (its return value can change) just because something outside and separate of it mutated goes against the very heart of functional programming, and is not how functional languages behave at all.

comment 10y ago · link · parent

Note that the objc.io book is more about building functional idioms from scratch so you can use swift in a functional way, rather than actually leveraging a strong functional core of the language. The fact remains that Swift is just not a functional language and attempts to categorize it as such are unrealistic.

2920.

Swift is not functional(robnapier.net ↗)

4 points · by hellofunk · 10y ago · discuss

comment 10y ago · link · parent

> Swift is widely marketed as a functional language

If that's true, those sources reporting that are wrong. Apple itself refers to it instead as a "protocol-oriented language" when it's not just saying "object-oriented".

Swift is definitely not a functional language in the way that it usually means, and Apple knows this, and any legit survey of languages wouldn't clump it together with much more functional languages. For example, this guy[0] knows what he is talking about.

> Where Swift shines it is in the integratiion with the underlying Objective C frameworks on the Mac.

>Swift is a good replacement for contexts in which Objective-C would be used.

Except when you try to do anything with OpenGL or a C-based API, like Core Audio. Swift is really lagging for "power programming" with these low-level APIs. It's great for beginners who use all the high-level frameworks (though "great" is a subjective term I don't really agree with for Swift), but a lot of people who really need to get stuff done on Apple's platform are not going whole-hog Swift.

>If you’re coming form Erlang/Haskell world you’ll think Swift is verbose and a bit of a mess but if you’re coming from Objective-C you’ll think “Swift is concise and elegant”

I got to be honest, I still find I prefer Objective-C, because, it's essentially C. I can use my C structs and interfaces with zero problem. But in Swift, all C primitives are translated into Swift-only stuff, even integers!

And don't get me started with trying to use a C++ library with Swift, something that's smooth with Objective-C. Which is ironic since Swift itself is written in C++.

[0] http://robnapier.net/swift-is-not-functional

comment 10y ago · link · parent

Wow that's crazy. I'm sure that usage is not the expectation from the app makers. It almost makes me wonder if there is a strange counter-psychology going on there, as if your acceptance was in part measured by your participation, and that if someone did not see a like from you, it had consequences.

comment 10y ago · link · parent

That a pretty funny irony you pointed out.

comment 10y ago · link · parent

Fair enough. I like to think of math as an art form, and I think on some levels it certainly is (as much as I'd also consider Einstein an artist in many ways). The end product is different than an "artist" but I think a lot of the thought processes overlap and cause similar perspectives.

comment 10y ago · link · parent

This helps to underscore that the field of mathematics is also an art form, since the behavior symptoms high-level math researchers are indistinguishable from "artist types"; Goedel, Riemann, Turing, and others come to mind. The "sensitivity" and "complexity" suggested in this article are not isolated to artists.

comment 10y ago · link · parent

I was surprised to see it downvoted so much, there was nothing bad about the comment, I found it rather charming.

comment 10y ago · link · parent

And even more specifically, I do believe the problems stem most from American teenage behavior, because while kids are kids the world around, American culture does have a much higher degree of judgemental behavior. I'm an American and my eyes were opened to how different it really is in the U.S. compared to other countries when I moved abroad several years ago.

comment 10y ago · link · parent

That's a bit strong. I love sharing photos with friends and family, and Instagram makes these super easy to do, and quickly, and with easy ways to get comments from those I'm interested in.

Instagram itself is not the problem. How teenagers are using social media is a behavior or perspective issue in my opinion, not a problem with an actual product that just offers a nice tool. Growing up before the internet, these attitudes were in effect, just exposed differently. Honestly I think it is a cultural problem, because there are other places in the world where this obsession with acceptance does not exist, and where everything is not driven by ego or lack thereof.

comment 10y ago · link · parent

I don't know why you deleted your other comment just now, but I agree with it. When I get just one like, I'm thinking to myself how awesome I must be because I touched another person's experience this moment with some photo or comment I made to the world electronically. If I got 15 likes, I'd be wondering if I'm some kind of gifted social icon without knowing it!

comment 10y ago · link · parent

Mm, it has tremendous shortcomings. A lot of pro shops can't use it any more.

comment 10y ago · link · parent

The REPL takes a bit to start, and then I leave it running for days. The startup time really has nothing to do with the development experience once you're in the system. Even very large projects compile in less than a second for me.

comment 10y ago · link · parent

Clojure is not really an option when you do systems programming, such as writing native apps, command line tools, working on small devices like a Pi, etc. There are many things I'm exploring in C++ for which Clojure is just not a good tool for the job.

But also, there are some really great C++ libraries in the areas of physics and graphics, and there is no equivalent of the in Java I could use.

comment 10y ago · link · parent

I agree. I've noticed that programmers are often evangelical about their favorite language, and it gets tiring sometimes to say "yeah, but..." Sometimes, you just need a different tool, and efforts to make one language do absolutely everything well are not usually the best way to spend one's time.

comment 10y ago · link · parent

This year, Clojure cemented itself as my favorite programming language, and I felt glad to be able to use it daily for my work, as it does take so much effort off the developer for little things, allowing one to concentrate more on big things.

However, it was also the year I learned that, while Clojure, as a dynamic typed language running on a VM, is the best of that class of languages, static system languages are still irreplaceable for so many other things. This was the year I realized that one language does not fit all, and that it is okay to have more than one favorite language. (And in my case, it is Clojure and C++ that I am now using equally, and with equal enjoyment, and for entirely different reasons).

comment 10y ago · link · parent

Speak for yourself. Diets motivated by iron deficiency are a real thing.

2936.

47 Filipino teens invade island China claims as its own(edition.cnn.com ↗)

4 points · by hellofunk · 10y ago · discuss

comment 10y ago · link · parent

The question is not whether the language has a native code compiler, as that rarely has a profound effect on the runtime speed of a language. Some native code languages are slower than VM and interpreted languages. And native code != native code. Objective-C and Swift both have native code compilers. But they are slower than C and C++ on the same platforms, for various reasons, such as: the runtime environment itself and how the runtime works, and, in the case of Swift, the organization of its LLVM code prior to final compilation.

comment 10y ago · link · parent

Why are so many of the books listed 2 or 3 times with the same title but different filename? Are they different versions or just redundant copies?
1
979899
110