
Show HN: Cupertino.js – A JavaScript to Cocoa compiler and runtime - jermar
https://github.com/jerrymarino/cupertinojs
======
phpnode
Good job for shipping, however this project and others like it (e.g.
RubyMotion) set off alarm bells for me personally.

I think the same arguments that people have against CoffeeScript apply here -
it's not possible to use CoffeeScript without knowing JavaScript, and in this
case it's not possible to use JavaScript without understanding the Objective-C
ecosystem. At this point, this is Objective-C with a different syntax, it's
not really JavaScript. Existing documentation, blog posts, stackoverflow
answers etc use Objective-C, so the programmer will have to do a lot of
translation in their heads. If I have to learn all the Objective-C / Cocoa
APIs anyway, what am I gaining by using a different syntax?

~~~
flyingbeaver
can't you just imagine that a lot of people think that ruby is far more
suitable/productive/readable to write applications than ObjC/Swift ? It's not
just about learning this or that...

Concerning the translations you are talking about, it's completely trivial if
you think the right way and don't just try to copy/paste things all the time.
It's about objects, methods, interfaces, whatever the examples are written
in...

~~~
phpnode
Most people who choose this kind of thing are not experienced with the
transpilation target, they're $language developers who want to avoid learning
a new $language. But of course the main challenge when learning a new language
is learning the standard libraries / eco-system, and these things don't help
at all with that, they obscure it.

Another problem is that they never solve the impedance mismatch, idiomatic JS
does not map cleanly to idiomatic ObjC, you end up with code that is idiomatic
in neither.

some clichés apply here:

"You can write fortran in any language"

"There are no silver bullets"

~~~
flyingbeaver
"If I have to learn all the Objective-C / Cocoa APIs anyway" and "who want to
avoid learning a new $language"...

Still not the issue, sure some people want to avoid to learn more, but that's
not people we are interested in, those people wouldn't learn anything
anyways... As you said, if you want to be very good yes you have to learn all
the tools. So for good developers it's not about learning this or that, it's
about learning both, and choosing the one you think is the best to write a
full application.

", idiomatic JS does not map cleanly to idiomatic ObjC, you end up with code
that is idiomatic in neither."

Sure, you end up with idiomatic RubyMotion. Is that an issue ?

------
javajosh
This project is _awesome_. Why? Because, if it succeeds, it means that a huge
amount of open-source, hackable JavaScript written for the open web has
another way[1] into a proprietary runtime. Depending on how the cross
compilation occurs, it could avoid a lot of the inevitable performance
degradation PhoneGap imposes.

My enthusiasm is muted, however, with the knowledge of how young this project
is. There's a _lot_ of work to do - implementing javascript platform methods
(e.g. String.subtr(), etc) alone will be a lot of work.

I'd also be curious to know how the author will be able to deal with meta-
programming in general, and eval() in particular.

[1] The other way is via WebView and/or something like PhoneGap[2]

[2] [http://phonegap.com/](http://phonegap.com/)

------
kika
I can recognize the hack value, but having a hard time imagining why would I
use it for something else than a hack value. If I wanted to develop, lets say,
an iOS app natively - I'd chose Obj-C (which I don't know good enough, so I'd
need to learn a little) or I'd use Swift (because it's a higher abstraction
level, I like FP, etc). If I'm good with a non-native implementation, I'd use
Cordova, Phonegap, etc.

In my limited understanding, JS and ObjC have almost the same level of
abstraction, so I do not quite understand what value this compiler brings to a
real life project.

And as @phpnode says, you still have to learn a lot of ObjC anyways.

------
bsimpson
If you wanted to target the Obj-C runtime, but aren't interested in learning
the syntax, wouldn't you just use Swift?

------
tolmasky
What is the advantage of this over exposing Cocoa Apis to Javascript (ala
JSTalk)? Seems like a lot of work to get parity with basic features like gc
and standard lib (not to mention putting the onus on yourself to keep updating
it as new ecmadcripts are released).

The advantage that comes to kind is that in theory if this is coffeescript-
esque than libraries written in Cupertino is should be "usable" by
objective-c? I haven't seen what the outputted code looks like though so I
have no idea if it'll be as seamless as coffeescript <\--> js.

------
ams6110
The name reminded me of [http://www.cappuccino-
project.org/](http://www.cappuccino-project.org/) but it's not really the same
thing; Cappuccino adds Objective-C-like method dispatch to javascript (they
call it Objective-J) and lets you use Interface Builder to create your UI.

------
nmb
At first I thought this was going to be a Javascript interface to SAT tutoring
centers and boba shops.

------
mwcampbell
What license is this under?

~~~
antoncohen
"All rights reserved"

[https://github.com/jerrymarino/cupertinojs/blob/355ea51/cujs...](https://github.com/jerrymarino/cupertinojs/blob/355ea51/cujs/main.cpp#L6)

------
idibidiart
I personally think it's great (... awaiting those down votes)

------
heromat
[https://rbt.asia/g/thread/41920845](https://rbt.asia/g/thread/41920845)

