It’s just data

DSL for JavaScript


Jeremy Ashkenas: “work towards building a language that is to ES6 as CoffeeScript is to ES5”… close, but—do it for [ES6+HTML+CSS], and you’ll win ;)

It occurs to me that there is a shortcut available.  Let a library like React replace [ES6+HTML+CSS].  Then build a DSL for that library.

JavaScript isn’t exactly known for its ability to build DSLs.  Ruby, however, is.  And has an excellent parser library.  By transforming the AST, I can convert calendar.js.rb into calendar.js.

In the process, I start by replacing JSX with a library which was inspired by Builder, Markaby, and Tagz.  These libraries, in turn were presumably inspired by earlier works like Perl’s CGI.

But there is more.  JSX can’t directly express iteration.  Look at CommentList from the React tutorial.  Instead you build up a list, and then subsequently wrap that list.  For nested lists, it appears worthwhile to split out separate components.  There is nothing wrong with doing that, but I will suggest that the primary reason to split out a component shouldn’t be to pander to the limitations of the programming language syntax.

In Ruby you can directly express iteration.  So where a comment box in the tutorial takes four classes, an entire calendar month can be expressed in one.

And there is even more.  Functions in JavaScript are the swiss army knives of programming language features.  The can be used to express classes, blocks, lambdas, procs.  But this flexiblity comes at a price.  Ruby2JS can detect when idioms like var self=this are needed and automatically apply them.

The net is that I can write smaller, more understandable code.  And in the process focus more on the problem I’m trying to solve.

Like with CoffeeScript, "It’s just JavaScript". The code compiles one-to-one into the equivalent JS, and there is no interpretation at runtime.  You can use any existing JavaScript library seamlessly from Ruby2JS (and vice-versa). The compiled output is readable and pretty-printed, will work in every JavaScript runtime, and tends to run as fast or faster than the equivalent handwritten JavaScript.

Now I don’t expect to have the success or impact that CoffeeScript has had.  But I can say that I’m having fun.  And in the process, I’m seeing the benefits with applications I write.

How could I create a slideshow that doesn’t go auto but waits for me to click next using JavaScript? I want to learn for DissertationHouse | Dissertation Help Should I really uptake Java if I’m going to be learning JavaScript?

Posted by Sarah Taylor at

The clear info get dissertation done on the rightest way to explain the  info towards meta-programming abilities due to the syntax of their language being the same as the syntax for the main data structure on  supported by the language - the humble list. These languages are therefore well suited for inventing smaller special purpose “domain specific languages.On my get dissertation done on initial part tries to explain the kinds of scenarios in which one might consider building a DSL, which is important to have an idea about. Later, I get into the actual representation using JSON.

Posted by KristenReid at

Good to be here and to gather this more interesting stuff, Thanks for helps me to use DSL in Java Scrip. That is so valuable information for me.

Posted by Candice Clings at

What a fine website i have come across. Thanks for sharing a fabulous piece of information. We are into assignment help sector and offer quality assignment writing solution to the students. Students can opt for our writing services to get their assignment written by experts.
Buy Assignment Help

Posted by Assignment expert at

Thank you for sharing a excellent part of data. We are into essays writing service sector and offer excellence essays writing way out to the learners.

Posted by UK Essays Writing Service at

No doubt! It will be truly hard enrolling! I wish you good fortunes!

Posted by Case Solution at

This is really a great stuff for sharing. Keep it up .Thanks for sharing.

Posted by HBS case analysis at

The unmistakable information complete paper on the rightest approach to clarify the information towards meta-programming capacities because of the linguistic structure of their dialect being the same as the sentence structure for the principle information structure on bolstered by the dialect the unassuming rundown. Understudies can select our composition administrations to get their task composed by specialists.

Posted by Custom Coursework Writing at

I just want to say thanks for your wonderful post, it is contain a lot of knowledge and information that i needed right now .

Posted by Namecheap Cyber Monday Deals at

University and colleges there are lots of students who are geek to their studies and improve their learning and sense of humor.

Posted by University Assignment Writing Help at

I always tell myself that im going to run 2 laps ...but i never have lol...Technically i dont think you are supossed to but i highly doubt anyone will tell you that you cant when your there. If you run another lap i say ya it should count towards another band...if not then whats the reason? because they didnt spend more money?? Money shouoldnt be the factor.

firfox 64 bit
Internet Explorer 11 Download
Apple Safari Download
Mozilla firefox 2016 free download
7 wonders of the world

Posted by mozilla firefox 2016 free download at

friv 2
Single gamer and also multiplayer game

Posted by friv 2 at

It’s really just what exactly Needed to check out anticipation around long run you are going to continue on to get spreading this sort of great posting.

Posted by Assignment Help online at

Style is the response to everything. A better approach to approach a dull or risky thing. To do a dull thing with style is desirable over doing an unsafe thing without it. To do a perilous thing with Marvin Martian style is the thing that I call craftsmanship.

Posted by Marvin Martian at

This is really great work. Thank you for sharing such a good and useful information here in the blog for students.

Posted by R Programming Help at

Well, you Ruby guys never get it, right? Every of your attempts to downplay JavaScript syntax as jokes and shoot for replacing anything with Ruby syntax were all failed and WILL all fail, no matter how hard you try. Now that Rubyists' bigotry has finally led you into decline, and that ECMAScript is going really strong, I wholeheartedly wish for Ruby cultists' never-returning to the JavaScript land.

Posted by Jesus at

It can also assume that you can do, you will be infinite vitality; you no longer feel it is easy to, you might have major depression.

Posted by shoes in stock at

This is really great work. Thank you for sharing such a good and useful information here in the blog for students.

Posted by annuaire de référencement at

Hey now a days Java script is integrated with AMp pages as well we have also used the AMP in our blog and one of our websites as well. So if you want to speedup your website then you can AMP to your website too

Posted by Ritu Rana at

thanks ritu your post is to nice

Posted by Seo Company at

Today Microsoft Windows is used many of the office for the commercial work. And many of the people is faced the technical issues of windows. And they are searching the trustful support at minimal price. So give me a chance to serve you, we are provide the technical support of Microsoft as a third party. To find support call on  Windows support number  +1-800-826-8068.

Posted by Windows support number at

Really don’t trust in like, even so i’m able to say yes to they, because it is the pleasure.

Posted by shoes in stock at

microsoft customer service number is toll-free number which is providing solution of microsoft related issues please call us on +1-800-805-7863.

Posted by microsoft customer service number at

Most simple way is utilizing javasript device. Download Smart Object Error Fixer Pro, it functions admirably.

Posted by web video production company at

Add your comment