gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNUstep, Google Summer of Code, and an idea


From: David Chisnall
Subject: Re: GNUstep, Google Summer of Code, and an idea
Date: Mon, 4 Apr 2011 23:42:04 +0100

Hi Lars,

On 4 Apr 2011, at 22:46, Lars Sonchocky-Helldorf wrote:

> today a co-worker of mine brought the Cappucino-Project to my attention. 
> 
> http://cappuccino.org/ is a JavaScript based Web-Framework which basically 
> implements the Cocoa-API using "Objective-J" which is a funky JavaScript 
> dialect modeled after Objective-C but implemented in JavaScript itself (it 
> sits on top so to say. 

I've seen Cappucino before, and in part it was the inspiration for this 
project. I don't really like their Objective-J language, so much though, 
because it is just different enough from Objective-C that the differences bite 
you.

It produces some really beautiful output though, and we did consider using some 
of their code for web apps made with Étoilé (they actually use some GNUstep 
code - at least according to their documentation, I've not looked at their code 
much), but I'm too lazy to write view classes in two languages.

> While I consider programming in "Objective-J" itself rather weird the 
> existence of such a framework only points out the importance of David's idea. 
> The world™  seems to be in need of viable web toolkits! 

Absolutely.  There are only a few thousand.  Definitely one more is needed!

> And I like the GWT (Google Web Toolkit)-like approach of David of compiling 
> to JavaScript better than writing in "Objective-J" which would IMHO only 
> feasible for people already living in the JavaScript-Land. Those people – on 
> the other hand – know the Cocoa API very rarely.

It would also be nice if we could use the same thing with our UIKit 
implementation (when it exists) - compile it for the web, and let people turn 
iPhone apps into web apps with a simple recompile.

> So I consider this an important project for GNUstep even if we don't find a 
> student for this (which means we need to implement this ourselves). 

The code is in trunk/Languages/ObjC2JS in étoilé svn currently, for anyone who 
wants to play with it.  In the test directory, you will find the JavaScript 
run-time support code (implements the C memory model and the Objective-C object 
model in terms of JavaScript), along with some .m files that contain tests 
(which all work, for me at least).  There is also a jstest.html.  This includes 
all of the run-time support scripts and jstest.js, then calls the main() 
function.  To test one of the files, just compile it to jstest.m and open this 
html file with your browser (tested with FireFox 4 - should also work with 
Chrome and the WebKit nightly builds[1]).  All of the bits of C that I have 
tested work, with three exceptions:

- 64-bit integers don't work, and aren't high up my todo list (ObjC2JS uses an 
ILP32 model)
- Casting integers to pointers does not work (although pointer arithmetic does, 
as does casting pointers to integers).  This is basically impossible in 
JavaScript, so I have no plans to implement it.
- Bitfields.  These are horrible, but GNUstep uses them all over the place, so 
I'll probably get around to it soon.

My next step is to implement some of the libc functions that we need (as 
wrappers around their JavaScript equivalents, or as stubs), and add some 
low-level classes like JSString, JSArray, JSDictionary as wrappers around 
JavaScript objects, so that we can use their abstract superclasses from GNUstep 
directly.  I also want to add either an implementation of -back, or an 
implementation of CoreGraphics + some event handling using the canvas tag.  We 
can probably implement CoreAnimation quite easily, since canvas elements 
themselves are effectively layers, and can be animated with a variety of 
techniques.

There are also a few things I need to add in the compiler.  Declared properties 
as lvalues in unary and binary operations is currently broken (e.g. a.b++; or 
a.b += 2, where a is an object and b is a property) and exceptions are not 
implemented (these are trivial to do, wrapping JavaScript exceptions).

I probably won't bother with C++ support, because it is a horrible language, 
unless someone wants to pay me a lot of money for it.

Anyway, my slightly rambling point is that I plan on spending some time working 
on this, and patches are always welcome...

David

[1] I use some JavaScript stuff to implement the C object model that are added 
for WebGL.  It's possible to implement (slow) versions of these in pure 
JavaScript, which I'll probably do at some point if I need compatibility with 
other browsers.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]