VOC: A transpiler that converts Python bytecode into Java bytecode
github.com> The Vereenigde Oostindische Compagnie (VOC), or Dutch East India Company, is often considered the be the world's first multinational corporation. ...
Ah, trivia time! The VOC also had the world's first entirely privatized army. The "monopoly" cited in the README basically included a license to kill. Think "Google Armed Forces", but then scarier. The army was mostly used to keep a grumpy unpaid workforce "motivated", to keep the spice coming, and thus to keep that lovely 18% annual dividend payout reality.
Basically, the VOC made current evil multinational corps (e.g. the oil companies, monsanto, blackwater, etc) look like cute cuddly charities.
That said, it's been centuries, not sure getting worked up about the name makes sense now. It's a compiler, not a guidebook about how to traffic humans. I just thought the README section made the VOC seem a "little" awesomer than they were.
I absolutely agree. The VOC was a very bad company. Basically, they took the blood of the native people in the spice countries and made money from it.
The enslaved the people and killed many, when they did not cooperate.
When the VOC is seen as basic example of corporations, it is a real gruesome heritage!
> "Basically, the VOC made current evil multinational corps (e.g. the oil companies, monsanto, blackwater, etc) look like cute cuddly charities."
DeBeers[1] and the United Fruit Company (Chiquita)[2] would be much more comparable to a modern day VOC and also still exist. Both just seem to be better at staying off the radar since the advent of the Internet compared to Monsanto and the others.
[1] https://en.wikipedia.org/wiki/De_Beers
[2] https://en.wikipedia.org/wiki/Chiquita_Brands_International
Britain had an East India Company first:
https://en.wikipedia.org/wiki/East_India_Company_%28disambig...
http://www.newstatesman.com/politics/politics/2014/04/worlds...
It's up for debate who was the first multinational. No doubt both set the bar very high for those to follow, but I do think blackwater spinoff dyncorp with child sex slaves will take some beating, particularly with respect to the prevailing moral climate of the time:
> Britain had an East India Company first:
Actually the Portuguese one was founded in 1549, but I will leave out the usual type of "products" that were traded in those days.
So well, one interesting question as to why this is at the top of hackernews is - do people not know about jython? Jython does exactly that - it compiles python into java (I think it emits bytecode and not Java source, but don't call me on that) with a lot of runtime so it can support proper semantics. It has been around for over a decade now too and it supports full python (with usual caveats)
Jython is quite outdated and has stagnated for a long time; support for Python 2.7 was only finalised in May this year. Forget about support for v3.5.
Perhaps by compiling from the bytecode of the existing interpreter, instead writing a whole new source code interpreter for the JVM, it will have some benefits in supporting newer versions of the language. Or, maybe it will help to decouple development of the standard library and the interpreter, possibly letting more devs work on it. You can't really be sure what benefits/deficiencies a different approach will bring until you actually try it - see PyPy, a "silly" idea to implement Python in Python, which now yields faster runtime performance than CPython.
This is exactly why I spent a few hours trying to work out if I could perform some advanced trickery to plumb the pypy tool chain into something that would end up producing a pypy.jar or other JVM equivalent. Turns out it's not that easy. C to JVM isn't a well trodden path.
Jython is awesome and all but its fighting an uphill war against rapid progress in 3 with far too few resources.
> C to JVM isn't a well trodden path.
But it does exist.
https://wiki.openjdk.java.net/display/Graal/Publications+and...
Check "Truffle C: Dynamic Execution of C on the Java Virtual Machine."
That is the usual "what's easier - starting from scratch or updating existing codebase to newer python". Obviously starting from scratch is more fun, but finishing it to support full python will be a major task that will probably not happen.
PS. Jython also would be called transpiler in modern lingo
One reason might be a development environment preference since developing directly in Jython would typically imply the overhead of the JVM. Another possible use case may be porting where a transpiler could address differences between implementations automatically that would otherwise have to be addressed more manually at the source code level.
To put it another way, Jython makes obvious sense when the primary target is the JVM and there's little legacy code. As target platforms proliferate and the code base becomes cruftier, it may become a less obvious choice.
I'm not sure the Pythonic "only one way" extends quite so far as to make Jython worthy of monopoly status.
How are the differences in the execution model handled? The defining quality of Python execution is that anything can monkey-patch anything at any time, using "setattr()". This means the obvious implementation has dictionaries for everything, and optimizers, as in PyPi have to work very, very hard.
So what did they do here? Is every object a dictionary to the Java runtime? That's easy enough to do, but no gain over CPython. Did they weaken the ability to modify objects so they could map to Java objects? That gets a performance win, as with Shed Skin, but a lot of Python code won't work. They're probably not doing all the stuff PyPi does; that's hard and took a decade of work by many people.
Did they really have to drag the Dutch east India company into this by using that logo? It's going to make things... complicated around here.
Don't really see why you got downvoted. It looks like they copied the logo exactly[1]. I'm rather surprised anyone would want to be associated with such an organization.
That is a bit odd, but kudos to them for finding a new way to play with the word "Java". I thought they'd all been used up by the late 90s.
Yeah, exactly. I was looking at the logo, and I thought "huh, that looks exactly like the Dutch East Indies company logo!"
After ctrl-f'ing to the first mention of "Dutch", I had to chuckle at their explanation though.
Besides, it's not like most technical product/project names are so great. I enjoyed this reference & their pun.
I'm kind of shocked that people here immediately recognize the logo for company that (according to wikipedia) stopped existing in 1799.
The VOC is important enough that you will learn about it in history classes in school, at least in some countries.
It's of historical significance.
It was a subject of this history video with 400K views on a pretty popular channel https://m.youtube.com/watch?v=zPIhMJGWiM8
Why would it make things complicated?
I think the VOC has ceased operations a long time ago (as opposed to the Hudson's Bay company)
Because for a lot of people in a lot of countries VOC was an oppressive regime. Sure, times were different, but these days you would put them into some sort of crimes against humanity tribunal. They caused a lot of suffering, so in a lot of places using that logo is not politically correct at all.
Crazy fact I just learned: The V.O.C. actually still exists as the Republic of Indonesia. Unfortunately at the moment it's not very common to put rulers of sovereign nations on humanity tribunals, regardless of the extent of their misdeeds.
Every nation has bad episodes in its history. What good would punishing the present-day Republic of Indonesia do?
I wasn't talking about punishing them for deeds in the past. Anyway, punishing heads of state of democratic countries is a bit weird anyway. We're not punishing Bush or Blair for the mess in Iraq either.
But we should be.
To what degree is the Republic of Indonesia actually ruled by the same folks that controlled the VOC?
Not the same people of course.
In a word: slavery.
The same reason most countries don't romanticize historical invaders / occupiers. Turns out it's not a cute memory when your people were on the business side of the invasion.
I think the business side of the invasion, in this case, was the business side of the invasion.
This can be very useful. I wonder what the plans are for supporting C apis, given that a lot of Python core libraries depend on C, in my neck of the woods numpy and scipy being the first contenders. There are long running projects http://www.jython.org and http://www.jyni.org, which, to the best of my knowledge, have not yet managed to fully support Python C extensions on the JVM.
They could run the C extensions on the JVM too, like the experimental jruby truffle backend does.
A Python and Truffle implementation already exists https://bitbucket.org/ssllab/zippy
I'm guessing none given it doesn't look to support Python's stdlib in the first place. The project seems to be quite literally what it says on the tin: it compiles Python bytecode to Java bytecode.
They also have an in-browser bytecode runner: https://github.com/pybee/batavia
That is called a compiler.
Transpilers are compilers... The term is usually used for a compiler which compiles between languages at about the same level of abstraction.
The term is usually used by people that don't know what compilers are.
Snark aside, I think this is actually the case. I bet there are a LOT of CoffeeScript/Javascript developers who have never worked in a compiled language.
A term that I only started seeing after the crazyness to compile to JavaScript started and a part of my major was compiler design.
Eh, it isn't starting with source code.
In the broadest sense a compiler is any program that translates between different representations af a program. In that sense one can also consider a decompiler as a compiler.
Also we usually use the term compilation (or more specifically Ahead Of Time and Just In Time compilation) for when we translate bytecode into machinecode.
Well, sure. I'm just saying that calling this something more specific than "compiler" isn't wrong.
Can someone give a valid reason for wanting this? I'm kind of confused as to why mixing and matching python and java source with some central compiler would be useful.
Just for fun? To take advantage of the Java ecosystem similarly to Jython?
Cool does this work on android ?
[EDIT] - I should have wrote, can this generate code that will work on Android ? [/EDIT]
performance?
question?