It’s just data

DSL for JavaScript

W

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.


Thanks for sharing this post! it was very informative and helpful! keep posting and updating all users! thanks!
https://geekybytes.net/trueskate-apk-download.html

Posted by Dann Flin at

Having issues while using xerox printer. Just a single call to us will get your problems resolved. our Xerox Printer Support will support you to solve the query. We are available 24×7. Contact us Xerox Printer Support

Posted by Xerox Printer Support at

Dissertation Guidance Provides quality Online Dissertation Help for students.

Posted by Take My Online Class For Me at

Amazing article thanks or sharing..

Posted by Marketing Research Homework Help at

awesome post

Posted by asus customer support at

Thanks for sharing this post! very informative and helpful! keep posting! great effort! Is its parent directory writable by the server?

Posted by Is its parent directory writable by the server? at

Well thanks for posting such an outstanding idea. I like this blog & I like the topic and thinking of making it right.

Posted by matlab tutor at

A browser is an application program that provides a way to look at and interact with all the information on the World Wide Web.  if any query to the related browser then you can contact Google Chrome Support Service

Posted by Jems Ford at

awesome post so thanks for sharing the post.

Posted by safari browser support at

The Leading Assignment Help UK Firm Offers State Of The Art Services To Its Clients With A Promise Of Delivering All The Required Work Well Within The Deadline.

Posted by SPSS Homework Online at

great post

Posted by Hitachi Customer Service at

NICE POST

Posted by OPERA CUSTOMER SUPPORT at

Hi buddy, your blog' s design is simple and clean and i like it. Your blog posts about Online writing Help are superb. Please keep them coming. Greets!

Posted by HBS Case Solutions at

This is really a nice and informative, containing all information and also has a great impact on the new technology. Thanks for sharing it. 
satta matka
satta matka
satta matka
satta matka
satta matka

Posted by satta matka at

nice post share with us.
  UC Browser customer service

Posted by Safari Browser Support at

Well thanks for posting such an outstanding idea. I like this blog & I like the topic and thinking of making it right.

Posted by medical assignment writing at

We are here to help you with any kind of issues related to your Gmail. for support service contact Gmail Customer Service .our expert will assist you and in no delay your problem will be resolved.

Posted by Gmail Support at

Thanks for sharing this post! checkout:
Best Linux Distro For Gaming

Posted by Cathy Brown at

This is great information for students. This article is very helpful i really like this blog thanks. I also have some information relevant for online dissertation help.

Posted by Matlab Project Help at

thanks for sharing very information post this is very useful post for student.

Posted by Lenovo Support Number at

Very informative article. Loved your effort in brining such a value to the content. Thanks for sharing.
xbox customer support

Posted by Xbox Customer Service at

Well thanks for posting such an outstanding idea..

Posted by Png at

Before you record something, be it in your home or a studio, the first thing you would require is a microphone and among them the condenser microphones are the best of the lot. To get suggestions about the best condenser microphones, just take a look at the site.

Posted by Best Condenser Mics at

Thanx for sharing such useful post keep it up :)

Posted by Basketball Hoop Reviews 2018 at

Things are very open and intensely clear explanation of issues. was truly information. Your website is very beneficial.

Posted by Do My Python Programming Project at

Thanks for sharing this post, it was great reading this article, would like to know more. Stay in touch, checkout Aptoide Apk

Posted by Garry Watson at

Thanks for this share, you must check out these posts they are very interesting @ GBA Games & How to give best man speech 2018

Posted by Linco Frank at

Thanks for sharing this post, keep in touch and stay connected, also get the best tv shows and movies free with the best platform with premium features at no cost
how to get Hulu free on android

Posted by Edwin Heart at

Thanks for sharing this post, very interesting and resourceful ! Also read How To Bypass Surveys

Posted by Liam at

Thanks for this share, it was very informative and helpful, keep posting and updating all users check out Best Micro Cut Shredder

Posted by Carl Bush at

Any kind of problem you face with MS Paint just reach out through our MS Paint Customer Service and get your problems solved.

Posted by MS Paint Customer Service at

Add your comment