什么是Objective-C的Mac编程的替代品? [英] What are alternatives to Objective-C for Mac programming?

查看:143
本文介绍了什么是Objective-C的Mac编程的替代品?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在无指针,垃圾收集的编程语言的世界中,我变得非常舒服。现在我要写一个小的Mac组件。我一直在学习Objective-C,但是当我面对悬挂指针的可能性和管理保留计数的需要时,我感到沮丧。



我知道Objective- C现在有垃圾收集,但这只适用于Leopard。我的组件也必须使用Tiger。



我需要访问一些不能用于Java的Cocoa库,

我的替代品是什么?特别是没有显式指针和自动垃圾回收。

解决方案

component是什么意思?你的意思是一大块代码或图书馆,你要交给其他人链接到他们的应用程序?如果是这样,那么在这个时候使用任何桥接语言是不现实的。虽然很多桥梁是非常好的,他们几乎总是有并发症和问题,大多数应用程序开发人员不会愿意处理使用单个组件,特别是如果它涉及带来一个实质的运行时。



桥梁是最有价值的桥梁其他语言库到你的Objective C应用程序。虽然你可以使用它们编写相当完整的应用程序,但这样做往往需要更好地理解Objective C,而不仅仅是编写一个Objective C应用程序,因为你需要理解和应对语言,对象模型,线程和内存分配阻抗不匹配发生。



这也是为什么许多人认为,即使你很熟悉一种语言,试图学习Cocoa使用这种语言通过桥梁通常更难学习使用Objective C。



最后,最近对桥接语言的大多数支持是由于BridgeSupport,在Leopard中添加了一个功能。即使是早已经迁移的桥梁,有时在使用Tiger和Leopard上的桥接语言可能有实质性差异的方式。此外,目前没有适用于iPhone的桥接支持,并且大多数桥接语言不会工作,如果这是一个问题。



最终,如果你正在写一个库这将被链接到其他应用程序,你需要运行在虎和豹,你需要访问Cocoa只有API我认为你会发现使用任何非Objective C解决方案很困难。


I've become very comfortable in the world of pointer-free, garbage-collected programming languages. Now I have to write a small Mac component. I've been learning Objective-C, but as I confront the possibility of dangling pointers and the need to manage retain counts, I feel disheartened.

I know that Objective-C now has garbage collection but this only works with Leopard. My component must work with Tiger, too.

I need to access some Cocoa libraries not available to Java, so that rules out my usual weapon of choice.

What are my alternatives? Especially with no explicit pointers and automatic garbage collection.

解决方案

What do you mean by "component?" Do you mean a chunk of code or a library you are going to hand to other people to link into their apps? If so then it is not realistic to use any of the bridged languages at this time. While a lot of the bridges are very nice, they almost always have complications and issues that most app developers will not be willing to deal with to use a single component, especially if it involves bringing in a substantial runtime.

The bridges are most valuable to bridge other language libraries into your Objective C app. While you can write fairly complete apps using them, doing so often requires a better understanding of Objective C than simply writing an Objective C application, since you need to understand and cope with the language, object model, threading, and memory allocation impedance mismatches that occur.

This is also why many people argue that even if you are quite familiar with a language, trying to learn Cocoa using that language through a bridge is generally more difficult that learning it using Objective C.

Finally, much of the recent support for bridged languages was due to "BridgeSupport," a feature was added in Leopard. Even bridges that predate that have been migrating towards, sometimes in such a way that using the bridged language on Tiger and Leopard can have substantial differences. Also, there is currently no bridge support for iPhone, and most bridged languages will not work on it, if that is an issue.

Ultimately, if you are writing a library that is going to be linked into other apps, you need to run on Tiger and Leopard, and you need to access Cocoa only APIs I think you will find using any non-Objective C solution quite difficult.

这篇关于什么是Objective-C的Mac编程的替代品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆