Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

If one views the CLR/.NET runtime and associated libraries as the future of windows, then the F# programming language could be seen in that light as the most native functional language. Meaning that it has support from the OS creator, presumably integrates best with their libraries, etc.

Is there a similar logical choice of language on the Mac OS X platform? While the most-native language itself is obviously Objective-C, is there a first-among-equals or most obvious functional paradigm language that stands out?

share|improve this question
    
why the down vote? I know it is somewhat subjective, but seems like it does have a (potentially useful) answer? –  sdg Nov 4 '11 at 1:16
    
My downvote was because your question is based on speculative assumptions, which you don't back with any actual facts. But even if the premise of your question is somehow true (I'm not saying it isn't, just that you didn't make the effort to show it), still I would probably downvote because the listed criteria for choosing a language made me think you are looking for shopping advice, not choosing a language (that's a personal dislike). Sorry it took me so long to explain the downvote. –  Yannis Rizos Nov 4 '11 at 3:34
    
@Yahhis Rizos - thanks for the details. My assumptions were not intended to be particularly speculative. Microsoft does support F# as their only/primary functional (non-research) language for .NET (that I know of), and it does therefore integrate well with .NET libraries, not clear what backing that would require. As far as shopping, that's why I tried to circumscribe my critera as best I could, but we may just disagree on these types of questions at all. thx –  sdg Nov 4 '11 at 12:48
add comment

3 Answers

up vote 6 down vote accepted

Objective-C, as has been said, is the lingua franca for Mac development, if you want to hook in with Cocoa easily. That said, the best alternative language for Cocoa development is probably MacRuby, which is a Ruby implemented in Obj-C and can directly interface with Cocoa. It's not a functional language, it has some functional constructs. It's sorta developed by Apple (open sourced from Apple).

If you want a functional language for Mac OSX development, I think the best choice is Nu, which is a sorta-Lisp dialect built in Obj-C and can hook directly into Cocoa. It's not like F# (supported by the OS creator), but it is actively developed.

share|improve this answer
    
Was not aware of Nu, thanks! –  sdg Nov 4 '11 at 12:49
add comment

I"m just going to to throw this out there from outside the functional programming community...

Objective-C++11

Or, more formally, Objective-C++ since clang finished implementing the full c++11 spec.

Programming primarily in C++11 gives you strong support for immutable data structures, template meta-programming and you can use Apple's blocks across all of C, C++ and Objective-C code. Blocks are easier to use than C++ lambdas, see Mike Ash's comparison.

At the same time, you can trivially flip between Objective-C and C++ classes in the same source file, each can contain pointers to the others objects, so calling native code is inherent.

share|improve this answer
    
"Functional" is a pretty fuzzy term, but I think it takes more than C++11's lambdas and closures to win that label. Those features are useful, but they make C++ functional only in the same sort of way that you can write OO code in C. Besides, the "functional" umbrella tends to extend over other features like partial function application/currying, every-expression-has-a-value, immutability by default, function clauses, guards... One might also expect other things that aren't strictly FP, like pattern matching. –  Warren Young Oct 9 '13 at 5:06
add comment

Mac/OS is based on "Objective C". This is basically C with added OO. It pre-dates C++ and is generally considered a cleaner and simpler OO version of C, but, without the backward compatibility. This is definiately the way to go if you want to access the Mac/OS specific features like the "Aqua" GUI.

As Mac/OS is based on BSD unix, the full catalog of Unix languages is available C,C++, perl,Python etc. etc. etc. These all work well but are not so well integrated with the Apple "eye candy".

share|improve this answer
4  
-1 Objective C doesn't predate C++. Both appeared in 1983, but Brad Cox and Tom Love started working on Objective C in 1981 and Bjarne Stroustrup began work on "C with Classes" in 1979, so C++ actually predates Objective C. Also saying that MacOS is based on BSD is not entirely accurate: MacOS X is based upon the Mach kernel, and it does include certain parts of NetBSD and FreeBSD via NeXTSTEP. MacOS X is based on NeXTSTEP (+other stuff) which in turn is based on BSD (+other stuff) would be a little bit more accurate. –  Yannis Rizos Nov 4 '11 at 2:57
4  
And of course "This is basically C with added OO", is extremely misleading. Objective C is basically C with Smalltalk-style messaging would be a better generalization... –  Yannis Rizos Nov 4 '11 at 3:00
    
@YannisRizos Are you saying Objective C has no OO? Displacing "C with added OO" and replacing it with "C with Smalltalk-style messaging" is no less misleading. –  Jason S Nov 4 '11 at 4:40
    
@JasonS You are right. Any generalization is misleading. But I would argue that "C with Smalltalk-style messaging" is a little bit more accurate than "C with added OO" as Smalltalk-style messaging implies OO (so I'm not saying Objective C has no OO) and it also provides a correct historical background, as achieving Smalltalk-style messaging in C was the main reason Objective C was created. –  Yannis Rizos Nov 4 '11 at 4:56
    
@YannisRizos Saying "MacOS X is based upon the Mach kernel" is not really any better. It would be more accurate to describe the OS X kernel as based on XNU, the BSD part of which provides the POSIX API, which is probably more relevant to this discussion than Mach, as it provides full POSIX compliance. –  Jason S Nov 4 '11 at 4:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.