14 ms·
RedScript – like CoffeeScript, in Ruby
- jlebrech 13y agodamn, i was expecting a coffescript like ruby.
- jjsz 13y agoI was expecting a coffescript Scala...
- robmclarty 13y agoCoffee chip salad? But seriously, yeah, I had in my mind Ruby blasphemously morphing into Python or something. I'll take Ruby -> JS though :)
- macournoyer 13y agoVery cool! But maintaining all those regular expressions will soon be a pain. You need a real lexer and parser :)
- adambrod 13y agoAbsolutely! I should have wrote on the page that it was only intended as an MVP style prototype. Just enough to play with. Hopefully someone wants to write one that will also output source maps :)
- deleted 13y ago[deleted]
- vezzy-fnord 13y agoWasn't adding Ruby-like syntax and syntactic sugar to JS the whole point of CoffeeScript in the first place? Although this is much closer to plain Ruby.
- jscheel 13y agoIt's a language mimicking ruby, inspired by coffeescript, which is a language inspired by ruby. We've come full circle!
- sthomas1618 13y agoI always felt CoffeeScript was closer to Python then Ruby. But maybe its just the significant whitespace that stands out to me.
- spacebe4time 13y agoYes, just as close to Python as Python to YAML /sarcasm.
- mratzloff 13y agoCoffeeScript was inspired by Python, Ruby, and Haskell.
- adambrod 13y agoYep, it has very close goals when compared to CoffeeScript. However for the most part RedScript ditched the "It's just Javacript" mantra. I also just wanted to learn Regular Expressions and Node so I thought I would make this to prototype an idea.
- tcfunk 13y agoIt would be awesome for something like this to become part of the Ruby on Rails toolchain down the road.
- roryokane 13y agoIt's pretty easy for language authors to integrate with Sprockets in Ruby on Rails. They just need to write an interface for Tilt (http://github.com/rtomayko/tilt http://github.com/rtomayko/tilt) . Though that interface needs to be written in Ruby, not JS.
- danso 13y agoThis is cool but I think the project would benefit from a feature comparison to CoffeeScript, which is the first thing that comes to mind when seeing this. CoffeeScript is very Ruby-like, but not quite...The big difference, among others, is significant whitespace. One Ruby feature that I was expecting to be in this was Ruby Enumerable objects. CoffeeScript has nice iterators like this: ages = for child, age of yearsOld "#{child} is #{age}" But not like Ruby: ages = yearsOld.map{|child, age| "#{child} is #{age}" }
- camus 13y agoages = "#{child} is #{age}" for child, age of yearsOld
- gberger 13y agoReading the project website (http://redscript.org/ http://redscript.org/), I got overly annoyed by: - the non-monospace font - the separation of RedScript and the compiled JS bit by the use of multiple spaces
- AndreasFrom 13y agoI agree with your second point, but the code is monospaced for me.
- ahoge 13y agoIt's only monospaced if your machine has one or more of these fonts installed: Monaco,"Bitstream Vera Sans Mono","Lucida Console",Terminal Font stacks should always end with a generic font family keyword. In this case: "monospace".
- sergeykish 13y agoFont is already "monospace" in your browser by default rules. It's reset that breaks things, see stylesheet.css:5 # unrelewant omited pre { font: inherit; }
- ahoge 13y agoHad the same argument about a year ago. No, once you override it, it's gone. The value of the font-family property is a single list, not a list of lists. Example: http://i.imgur.com/8TLBd.png http://i.imgur.com/8TLBd.png It doesn't work with inheritance and it also won't work if the very same selector is used. E.g. if you add: .comment{font-family:foo} to the current stylesheet, you'll get Times New Roman (or whatever your browser's default font is.) Hence this line: http://www.w3.org/TR/CSS2/fonts.html#font-family-prop http://www.w3.org/TR/CSS2/fonts.html#font-family-prop "Style sheet designers are encouraged to offer a generic font family as a last alternative."
- adambrod 13y agoYea I definitely need to get a better side by side separation. When I originally released it there was little interest and I became too busy with other jobs to continue putting time into it. Maybe next week though!
- jaredcwhite 13y agoSomething like this is nice, and might appeal to people that want a simple, reasonably 1:1 compilation comparison between the language and the underlying JS implementation. However, I personally am FAR more excited about something like http://opalrb.org http://opalrb.org which essentially provides a Ruby runtime in JS and lets you run complex code with real Ruby syntax and runtime library features. I have been extensively testing Opal with just about everything I can throw at it and am constantly blown away by just how much it feels like I'm really running Ruby code client-side. Incredibly powerful stuff that would be a PITA to write in Javascript is a breeze with Opal. Browser compatibility doesn't seem to be an issue (IE 8, older Android, etc. all working). Sorry, I know I sound like a fanboy now, and I swear I have no connection to the Opal devs (didn't even know about the project until last week), but since I've really really wanted for some time now to skip the "CoffeeScript" phase altogether and wait until I can write genuine Ruby front-end code that compiles to JS, I am super excited. Good luck to RedScript though, that's also an interested project and, again, might appeal to people (not me) who want something extremely lightweight.
- dclowd9901 13y agoWhy not? Ruby-nuts have been trying to reshape JS into Ruby for years now. Might as well just go full balls on it.
- adamkittelson 13y agoOddly enough that was done years ago via Silverlight of all things. http://www.rubyinside.com/ironruby-silverlight-ruby-in-browser-3192.html http://www.rubyinside.com/ironruby-silverlight-ruby-in-brows...
- kibibu 13y agoApologies if you just used a neologism, but I believe the phrase is "full bore".
- prophetjohn 13y ago"Full balls" is pretty colloquial, but I imagine it was intentional. It makes sense to me. Kind of like "balls out" or "balls to the wall." Or even "balls deep." Y'know?
- saltyknuckles 13y agoI hate javascript but this is pretty cool.
- knodi 13y agoI like this a lot more then I like CoffeScript.
- brownBananas 13y agoYou should write a new language called Rucoffee. It's CoffeeScript that looks like Ruby. Will definitely give you 100+ stars on Github.
- idProQuo 13y agoDefinitely check out CaféAuLait: it's French that compiles into CoffeeScript.
- deleted 13y ago[deleted]
- knappador 13y agoCan we just get LLVM on browsers to compile embedded IF with JS-to-IF (or existing VM) as legacy? Think about it. Every three months, "omg THIS in Javascript!" and every fourth month, "omg THIS language becomes Javascript!" Can we just get an acceptable LLVM sandbox that uses the browser as sort of the OS and -actually- can do everything we need the runtime environment to do instead of giving us more and more relatively fake advances in user-facing software?
- roryokane 13y agoI think asm.js aims to fill this niche.
- DanielRibeiro 13y agoWell, that and Emscripten[1], which is the tool Mozilla used to bring Unreal Engine 3 into the web[2]. Note taht Emscripten is actually entitled An LLVM-to-JavaScript Compiler [1] https://github.com/kripken/emscripten https://github.com/kripken/emscripten [2] https://blog.mozilla.org/blog/2013/03/27/mozilla-is-unlocking-the-power-of-the-web-as-a-platform-for-gaming/ https://blog.mozilla.org/blog/2013/03/27/mozilla-is-unlockin...
- necubi 13y agoThis is precisely the aim of Google's pNaCl (portable native client): http://www.chromium.org/nativeclient/pnacl http://www.chromium.org/nativeclient/pnacl.
- Touche 13y agoLLVM isn't portable.
- knappador 13y agoNot sure to what degree we're talking. ARM + x86 has basically everything covered. Even -if- ARM support is bad now, completing it would be easier than creating exactly the custom toolchains that LLVM was designed to abstract away. Who runs browsers on PPC or whatever that isn't consciously taking responsibility for their access to portable software? http://llvm.org/docs/HowToBuildOnARM.html http://llvm.org/docs/HowToBuildOnARM.html
- icambron 13y agoThe file extension should probably be .red, not .rs. rs is taken by Rust.
- chrismorgan 13y agoAgreeing with you, I filed it as an issue: https://github.com/AdamBrodzinski/RedScript/issues/1 https://github.com/AdamBrodzinski/RedScript/issues/1
- draegtun 13y ago.red is already being used by Red - http://www.red-lang.org http://www.red-lang.org
- adambrod 13y agoThanks for bringing this to my attention! I didn't realize Rust had an .rs extension. If RedScript can get a real production ready compiler, we can definitely change it to something else.
- TallboyOne 13y agoHey man... Pineapple would like to say..... awesome work!
- adambrod 13y agoHaha, thanks! Want to help write a real compiler? ;)
- mjhea0 13y agolove this. although i am annoyed that the redscript and subsequent javascript examples are merely split by spaces on the website.
- adambrod 13y agoI agree, I need to work on a better side by side example. I just pasted them into vim side by side and called it a day so I could ship it.