分享

Objective Lua: Objectifying Lua

 quasiceo 2014-01-20

Objective Lua

New! v0.1 released! This time we're serious!

What?

Objective Lua is an almost pure superset of Lua that welds the Objective C object orientation system and syntax on top of the classic Lua language. It is written entirely in Lua and works by translating Objective Lua code into Lua code as it is loaded. This means that it's incredibly portable and incredibly fast.

What you get out of the language are:

  • All the speed and flexibility of traditional Lua
  • Seamless interoperability with Lua
  • A formal, precise object orientation system
  • Proper exception handling (including finally!)
  • All the clarity of the Objective C method syntax
  • Only 3000 lines of code, including the documentation!

For more information, I'd encourage you to read the online documentation. Alternatively, you could look at an example program. You probably also want to check out the FAQ.

Why?

Hack value?

It started out as, more or less, a joke I put together in a few hours. It went memetic and I realised that there was actually quite a lot of interest. The Objective C class system, stolen more or less intact from Smalltalk, is interesting as it's largely orthogonal from the actual language. It can, with a suprisingly small amount of work, be dropped more or less intact into another language. And it has been: there's Objective-J, Objective Perl, and Objective Modula-2, for example, which are Objectified Javascript and Modula-2 respectively. So there's precedent.

The other thing is that writing the example program for Objective Lua just felt so comfortable. The dynamic nature of the Objective C class structure is a natural fit to Lua's dynamic types and ad-hoc data structures. I did later find a few places where the syntaxes clashed --- that's why Objective Lua is only nearly a strict superset of Lua --- but even after rejigging the syntax to work around these issues, that feeling of ease remained. For me, at least, code just flows smoothly when writing Objective Lua.

How?

Objective Lua is a personality skin for Lua. That is, it's a layer that sits in the package loader list which reads in Objective Lua .olua files and translates them to classic Lua code as needed.

What this means is that Objective Lua code is, to all intents and purposes, Lua code --- once it's been loaded. This means that Objective Lua code interoperates seamlessly with Lua. You can call one from the other (because they're the same language).

I've also taken care that the Objective Lua object system is as compatible as possible with standard Lua practices. You can call Objective Lua objects using the standard object:method(args) syntax, if you want. Conversely, you can use Objective Lua syntax to call methods on any Lua object; they don't have to be owned by Objective Lua (or even subclassed from olua.lib.Object).

Documentation is provided; currently it's a bit sparse but should be complete. API documents are created automatically from annotated source by a tool called oldot (provided. Naturally, it's written in Objective Lua). I'd also encourage you to join the mailing list for assistance. (Especially, for non-sensitive issues I'd prefer you emailed the list than mail me directly.)

Why not?

Objective Lua is experimental software. It's an interesting experiment. It's not complete --- there are many bugs and omissions --- and there's no guarantee that any of the APIs or even the syntax will remain stable. While I don't think there are any showstopping bugs, I'd get a little twitchy if anyone announced they were writing big software projects in it.

Where?

Objective Lua is hosted on SourceForge.

SourceForge.net Logo

You can get the most recent version of Objective Lua from the project download page.

What's new?

Version 0.1, 2009-12-16: First real release.

Version 0.0.1, 2009-10-05: The toy release.

Who?

Objective Lua was written by David Given. The program is freely distributable under the terms of the MIT License.

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多