Mirah Tries To Make Java Fun With Ruby Syntax
An anonymous reader writes "Java is performant, widely adopted and eminently portable, however, its syntax is largely inherited from C++ along with some of its esoteric unfriendliness. Mirah aims to place a friendly face on Java through the implementation of a syntax whose primary concern is developer friendliness (think Ruby/Python/Groovy), and route of least surprise. The result is a truly cogent alternative syntax delivering readability, expressiveness and some compelling new language features."
Mirah looks to me so far like a waste of effort. It has somewhat nice syntax, granted, but if you really want to use Ruby syntax with the JVM, there already is something that does that: JRuby.
If you just want simplified syntax, Groovy is just as simple and looks more familiar to Java programmers.
If you want simplified syntax and powerful new programming tricks, Scala and Clojure do this far better. If you ignore the Scala libraries and half its features, you get everything that Mirah was designed to do.
The language designers should do a better job explaining why this is worth paying attention to.
Doesn't Groovy and Grails already do that? Speaking as a LAMP developer who uses Groovy/grails, I figured that WAS Java's answer cause I'm having a blast and dumping PHP like a hot potato.
This is my sig. There are many like it but this one is mine.
well...what languages you started with. Looking at that, the c++ based code is perfectly readable, but I can't make heads or tails of the other. In fact, reminds me of perl and objectiveC - just start hitting all those shifted characters - they each signify something special.
Am waiting for :
Draw Pacman;
Draw Ghosts;
Ghosts chase pacman;
Pacman follows joystick movement;
Yes, that's right, I prefer C++ syntax and coding style. Efficient, does exactly what I tell it to and makes sense in my head. All this Python/Ruby etc just makes my head blow up. I often code in those languages and I see them as very useful (and easy to work with), but I still prefer C++ syntax.
Have you heard about SoylentNews?
From what I gathered on their website, Mirah was created by one of the main JRuby developers in order to create a language that fits in better with the JVM capabilities and Java ecosystem than a strait port of Ruby. The end result should offer better performance and cleaner integration with existing Java code then JRuby, while providing nicer syntax than Java.
Groovy is slow as snot, and I wouldn't use it for anything other than perhaps a user scripting language for a java application, and even for that I think there are better options. No clue how Mirah compares to Scala. That was my first question as well.
Because it compiles down to native Java, without any of the JRuby overhead.
Don't thank God, thank a doctor!
Can't be helped. Every time someone takes a crap another offshoot of C seems to appear.
"Prepend" isn't a word either, but technical people use it a lot because there is a specific meaning there that needs a word -- to append at the beginning. Strictly speaking you could use "prefix" as a verb, but that word has a connotation of adding a small fixed string to the beginning of one or more items. "Prefix all international phone numbers with a + symbol." "Prepend the header before sending the request."
Similarly there is a need for a concise expression meaning "of adequate performance" without stretching to "high-performance" (especially since High Performance Computing has a specific meaning of its own). Unfortunately, in the modern language of hyperbole, terms like "adequate" and "acceptable" have negative connotations along the lines of "not really good enough but better than nothing". So, we, as an industry, have invented a jargon word "performant" to express the idea that a thing has a level of performance sufficient that you don't need to worry about it and can look for optimisations elsewhere in your system.
Be careful. People in masks cannot be trusted.
Objective-C and C++ were created at the roughly same time, with the early work done without any knowledge of each other. OPPC (the early version of Objective-C) was written around 1981-82. "C with Classes" (the early version of C++) was written around 1979-83. The first books documenting Objective C and C++ were released in 1986 and 1985 respectively.Objective-C was standardized (as part of OpenStep) in 1994, while C++ became an ISO standard in 1998.
Apple didn't choose to use it because C++ wasn't different enough; they chose to use it because that is what the NextStep was written with back when Objective-C and C++ were both still in their infancy.
This I don't get. If you want "developer friendliness" and "least surprise", use a syntax with the (relatively) minimal set of keywords/tokens to accomplish your task. Ruby has basically incorporated the syntax and conventions of every major programming language of the last 30 years...
And I guess you could call it "developer friendliness" if you want to let people freeform program in whatever style they want, with no two developers tending to use the same syntax for the same implementation - but at this point in my career (ie having worked for half a dozen companies and realizing what you write now may exist for decades), I consider a major component of "developer friendliness" as "easily comprehensible and maintainable by the next developer".
I may be the only programmer in the world that is willing to admit it, but having programmed in Java since version 1.0, I really like the syntax. And yes, I do find Java a lot of fun, especially for serious enterprise development. The thing I presently hate the most about Java is that new 'Oracle' thing.
Goodbye Slashdot. You've changed.
I am a guy who loves computer languages. I had a lot of fun with Ada for gawd's sake. I am pursuing erlang at the moment. Thought about haskell but it was just too big to play with...
So keeping that in mind?.... Java and the JVM was a non-starter for me.
Every time a new object oriented language comes out the purists start with "we don't need multiple inheritance" and so on, and they always end up having to hack it back in as some half-conceived junk (see "interfaces" providing, at a later date, all the much shat upon "complexity" of multiple inheritance with none of the ability to provide a default implementation, so then you add delegation which is all the default implementation with none of the inheritance etc...). "Java doesn't have pointers" my pasty white behind, every object is a pointer in java, you just can't use them properly, but they do manage to use pointers to prevent first class object copying, so then they added clone() etc.
Then they "didn't need" proper destructor behavior, we have a finalize that would run at some time in the future, but really the code out to know when the last object reference is going out of scope so it can call a destructor manually if it wants. That was a stopper for me.
See they coded their "every other language should have remained pure" hubris into their virtual machine, they encoded it into their hardware, from inception they designed their system to be limited and resistant to repair. So no thank you. So now Ruby fans want to take their niche language and cram it into the fundamentally flawed Java VM. Ooooohhh sign me up!
I swear the language feels like it was designed on a dirty napkin by someone who had no grasp of scope or symmetry.
Might as well be Python (I am old enough to remember RPG and COBOL Coding Forms, saving one apparent character, e.g. "}", (because in Python ":[newline]" is the same as "{" so what did we save again?) for the privilege of using white space, and counting tabs, as a control structure. And save the "but now we have editors to help us so that doesn't matter" tripe, we had coding forms to "help us" etc. And I suppose its okay to hack off a foot because you can alwasy get a peg-leg to help you too?
Why is it that each new generation of "language designers" insist on reinventing the same old square-wheels of the previous generation and calling it new?
Now get of my damn lawn... (yes, this rant makes me feel old, but come on people, imagine where we would be going if you would just stop trying to reopen the same tapped out mines...)
Innocent people shouldn't be forced to pay for inferior software development.
--"Code Complete" Microsoft Press
If C/C++ were so developer un-friendly you would not find them under the hood of pretty much every new language that claims 'developer friendly,easier,etc etc etc ' that came out in the last 20 or so years. Take Java , .NET etc all have some sort of C under the hood.
It's not that C/C++ is not developer friendly. It's that a lot of developers(apparently) are simply not that good to begin with. While Java , C#, JRuby etc etc etc make things 'easier' (according to some people at least) they ALSO hide a lot of things that a GOOD developer _should_ know in orderr to understand what is going on under the hood.
I see and hear a lot of kids fresh out of University that never even used C/C++ (which frankly baffles me to this day) ask question like " What is a refference","Oh i thought the GC would take care of that"
He did share them... stop trying to "solve" the problem of programmers needing to know how to program by writing languages that try to cover for dummies. We have plenty of languages that dummies can use safely. The problem has been solved.
Computer languages are like power tools. They can be "so safe, but no safer" before they start losing function. They just _don't_ make a band saw that any 12 year old can use in complete safety. Same for joiner, circular saw, planer, or just good old knife.
Tools are _not_ supposed to be _safe_. They are only supposed to be "no more dangerous than necessary". We make cheap plastic toy versions of tools for kids to practice with, but eventually they either go away or they have to learn to use the real thing.
I will believe in these "for dummies" versions of language the day a contractor shows up at my house with a Fischer-Price nail gun that will actually hold up sheet rock but is safe enough to hand to my neighbor's 5 year old.
The "clever new idea" is that people don't _deserve_ to operate in fields where they are unwilling or unable to learn the skills required. This is just as true of my profession (programming etc) is it is true that my programming acumen doesn't mean that I should be able to walk into CERN and have a go at the LHC even though I know squat about high-energy physics.
Read the signature line (v v v v v v v v), it is a truism.
Innocent people shouldn't be forced to pay for inferior software development.
--"Code Complete" Microsoft Press
Hate to tell ya, but once the dictionary adds a definition to a word, that definition is no longer incorrect.
Dictionary definitions reflect modern and changing language usage by the public. It's like a democratically elected office for words: members of the general public choose words based on misinformation, stubbornness, and the way their parents, friends and teachers choose their words. Dictionary editors are like the electoral college: they look at what the general public has chosen to use for words and definitions, then choose for themselves which of those make it into the dictionary. Not everyone will agree on the new word or definition, but in a few generations it will be history and no one will care. When was the last time you heard anyone bitch about Grover Cleavland being elected?
I don't like Java, but I do have a couple of issues here:
Java doesn't have pointers" my pasty white behind, every object is a pointer in java,
Every object is a reference in Java. There is a world of difference between a name which refers to some object and an integer which might refer to some object, but you can still do integer math, and the object might not even be there anymore...
This is almost as if you're trying not to see the advantages. No more segfaults. No double-frees, no crazy-ass debugging where the wrong method gets called because your pointer is pointing to the wrong (or a corrupt) vtable, and you really have to try to get a memory leak.
they do manage to use pointers to prevent first class object copying, so then they added clone() etc.
And the number of times I should've just passed the original object, vs the number of times I really didn't want it to implicitly clone something? Again, I have to give this one to Java, with the caveat that the interface to clone() kind of sucks. Ruby has dup, and all objects have it by default. Implementing clone() in Java is a pain, and if an object doesn't implement it, you're SOL.
the code out to know when the last object reference is going out of scope so it can call a destructor manually if it wants. That was a stopper for me.
Really? This?
Think back to all the destructors you've ever written in C++. How many of them can you count that did more than free memory? In other words, how many destructors have you ever written which aren't entirely replaced by the garbage collector?
I can pretty much count them on one hand. Filehandles, DB handles, etc. Yes, it sucks, but having to close a filehandle vs having to free every bit of memory I ever allocate? I'll take the filehandle.
So now Ruby fans want to take their niche language and cram it into the fundamentally flawed Java VM.
Wait, what?
You haven't mentioned a single issue with the JVM. Your complaints have been about the Java language. Surely you can tell the difference?
Oh, alright, you had one other complaint: You don't like the lack of proper destructors. Guess what? Ruby doesn't have them either. Ruby has finalizers, just like Java. Of course, I don't see anything about the JVM's design that prevents a language from implementing destructors anyway.
It's also funny how you, like most of Slashdot, seems to have missed the point: JRuby exists, and is pretty much neck and neck with the official C Ruby implementation in terms of performance. It's just as stable, and almost everything that works in one implementation works in the other -- kind of like how you can have multiple C compiles.
This article was about Mirah, which is not Ruby, nor trying to be. It's a way to make Java suck less, at least syntactically. If your gripe isn't with the syntax, you probably won't care about Mirah.
And for a bit of balance, here's the features I really, really miss in Java:
Don't thank God, thank a doctor!
The original goal of Mirah was to create a language that looked nice, compiled down to a form as direct and fast as Java, and did not require you to drag a runtime library along with you. You take Mirah code in and get JVM bytecode (in .class files) out. There's no extra dependencies; you're not shackled to an extra jar file just because you wrote "hello world".
Mirah has much of Ruby's syntax only because we liked Ruby's syntax. The Ruby class libraries are not there, and Mirah is not Ruby. It's statically typed, with Ruby's clean syntax and some of Ruby's surface-level features (like simple iteration and closures).
I guess you're right, we need to do a better job explaining why it's useful. I have an article coming that emphasizes that this is simply a "javac" alternative that happens to have Ruby syntax, and hope to clean up the web site too.
Problem is: when I look at your python code, I don't know if I'm looking at spaces, or tabs, or some combination of both. Not without a hex dump, or something. And one invisible character out of place, and god-only-knows what sort of unexpected results I get.
Also, I probably can not cut-and-paste your code into mine, and have it work, without substantial modification.
Then there is the serious issue of emailing code, or cutting-and-pasting from a web-site.
Too bad that practically everybody on slashdot thinks of BASIC as GW-BASIC. Most versions of BASIC, that are less than 30 years old, actually have it right - no curly brackets, no counting spaces and tabs either.
I _massively_ use destructors for doing more than freeing memory, particularly in multi-threaded code.
Iet's see...
closing files.
Releasing, e.g. _unlocking_ regions of files shared between applications (e.g. matching flock() calls between constructor and destructor to lock and release records at precise times).
Terminating protocols semantically and _then_ closing sockets instead of just closing sockets.
Issuing signals on the _last_ release of a mutex that is coupled with a condition variable instead of on every release of a nested mutex.
Unlocking and dismissing shared object libraries (e.g. undoing dlopen()) when, but not before, the last instance of any/every object dependent on the shared object file goes out of scope.
Preventing "Cruft" in my heap by doing "deep" memory frees of complex structures as soon as I no longer need them instead of at "some random time in the future if ever".
Changing modes and states on devices using ioctl() etc. (e.g. when the last "raw" use of the controlling terminal goes out of scope you put the terminal back into line mode until/unless you need to bring it back into raw mode.)
Resetting hardware on last use.
Emulating devices and subsystems that, by definition, reset themselves on last use.
Doing all of the above with "exception safety" without having to write a ass-ton of "finally" blocks (though I _do_ whish C++ had "finally" 8-).
Doing all of the above in "deep structures" so that my objects are true active objects instead of just nested hunks of memory.
You are like a blind guy asking "when was the last time you really used your eyes for anything but reading" because you have never heard of art, when you presume destructors are "really just for freeing memory" you demonstrate a horrific limitation in your understating of object, functional, and event driven programming.. Just because you don't understand the non-beginner ways to use a construct doesn't mean the construct is only used the way a beginner would use it.
Meanwhile:
I lived through the "P-System" and "P-Code" the shortcomings and costs overheads and raft of annoying assumptions built into the JVM are a "given" to me. Sorry for not doubling the size of my rant to make you happy. I work with too many system internals to think the JVM is a win. You go back to treating your heap as executable, and over-stressing your CPU translation look-aside buffers, and leave me alone... 8-)
In counterpoint:
I think closures are overrated, but I don't disparage them because I recognize that the fact that just because "they have never been particularly necessary or useful to anything I have done" doesn't mean that they are unnecessary or useless to persons other than I. Plus you can pull the same thing more or less in C and C++, for a limited number of variables, by returning a pointer to a nested function, but like eeew.... Closures do typically require an executable data segment, which I find impure, but all of java requires an executable data segment so who am I to judge. Closures are just the latest brand of secret sauce to allow people to throw memory at a problem instead of logic. 8-)
Innocent people shouldn't be forced to pay for inferior software development.
--"Code Complete" Microsoft Press
I don't remember where I read it, but I read somewhere that Ruby works as a "programming skill amplifier." As in, if you're a great programmer, Ruby allows you to write beautiful code, but if you're a poor programmer, Ruby will allow you to write the most hideous thing that your processor has ever seen.
And I agree. For better or worse, I think it's a testimony to the power that lies in the language.
Life is Reality