Google Groups

Re: [coffeescript] Source map support plan


Rob Tsuk Dec 21, 2011 5:13 PM
Posted in group: CoffeeScript
Progress. https://gist.github.com/1508440


I decided against changing all the constructors, but I have to give the .setLocation() approach more thought. It is uglifying. Any suggestions welcomed.

On Wed, Dec 21, 2011 at 7:43 AM, Steve Howell <show...@yahoo.com> wrote:
Hi Rob,

This looks like a good plan to me.

The Location object seems like a good way to make the patch a little less invasive with respect to grammar.coffee, and it could be extended eventually to have column support as well as just the line number.

As I mentioned on ticket 558, there have been some previous patches that got rejected due to all the special cases in grammar.coffee, which you are obviously aware of.  It would be great to get some buy-in from the core contributors before proceeding, so you might want to ping them on the ticket.

My two cents is that line number support is obviously important, so if it comes at the cost of a little complexity in grammar.coffee, it is well worth it.  I think a well-designed patch would make the code a little uglier, but it wouldn't really make it more complex.  Sure, each line would have to pass along a little more state to create the node, but it wouldn't require any complex constructs.

There are probably some opportunities to pre-factoring grammar.coffee to make a line-number patch easier, but the more I think about it, the more I think we should just go for it, and future patches could probably clean it up.

The timing seems right to me.  At this point the CoffeeScript grammar should be pretty stable.  From my perspective, the best thing to do with CS now is to leave the core language more or less alone, because it's really beautiful as it stands.  If the language can stay relatively stable, it would create a great opportunity to close the gaps on tooling, and line number support is a big part of that.




From: Rob Tsuk <rob...@google.com>
To: coffeescript <coffee...@googlegroups.com>
Sent: Tuesday, December 20, 2011 4:42 PM
Subject: [coffeescript] Source map support plan

Hi everyone,

I put together a small plan for adding source map support to CoffeeScript. If you have any interest or experience in the area, please give it a read and see if you think it makes sense. I'm hoping to use the relative down time of the holidays to get a patch ready to go, so I'll be starting work on this soon.

Thanks!
Rob