race = (winner, runners…) ->
print winner, runners
race = function() {
var runners, winner;
winner = arguments[0], runners = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
return print(winner, runners);
};
<script type="text/javascript" src="new_language.js" />
// set's the style of new_language to: 'display: none;'
<div id="new_language">
alert doc.thing
</div>
<body onload="new_lang_execute()">
<script type="text/javascript" src="/path/to/newlang.js">
<script type="application/x-newlang">
// code using your new language here
</script>
mind. The disadvantage though, is that you must compile to javascript first. I love jQuery as a good
javascript library, but I'm starting to think that it would be cool to create a new language in javascript
itself that would run in the browser.
I'm not too sure about speed, but I don't think that it would be too much of an issue if the language was
compiled directly into javascript.
First of all, I would like to offer a more logical approach to DOM object access:
Raw
jQuery
New Language
The point being that dom.thing would automatically access the value of the "thing" element. If "thing"
happened to be a <div> then typing dom.thing would be equal to document.getElementById("thing").innerHTML
The only way to include the new language scripts that I can see, would be to use a div with an id that has a style set
by calling the language library.
Then, on load you could execute the script:
Which looks for the id's innerHTML and does the rest for you.
This might be a dumb idea, but I think it would be fun to write. If anyone has any reasons why this is a good idea please
share. If it's a dumb idea, please explain.