Pluggable language features / macros?

Topics: General, Language Specification
Jan 31, 2013 at 1:49 PM
I'm currently using typescript for my projects and I must say I really love it. I'm very excited about its future and look forward to lots of new features as they come online. However one thing that I think TypeScript could really benefit from is a nuget style plugin for the language features.

My reasons for this is that it seems there are two schools of thought on the direction of TypeScript. One school asks that TypeScript stays close to javascript and that language enhancements should map closely to the outputted code and that ECMA-6 is the guiding factor. The other school is looking for new features in the language which are in conflict with the first such as Async/Await support. I think its likely that a feature such as Async/Await would be very useful to a lot of devs, but those fighting the "its hiding javascript" fight will probably be put off.

So perhaps the solution is to build typescript in a way so that we can choose the features we want in our apps. If we are happy with async /support and generics we could simple choose those options. They could be downloadable macro's which plugin to the language and compiler?

Anyway its' just a thought, would be good to hear what others think.
Jan 31, 2013 at 2:03 PM
<div dir="ltr">This would be extraordinary, but from my own experience with custom languages compilers, you have to start from zero supporting a plug-gable(dynamic) architecture. I doubt that Typescript was built with such a future in mind. <div style="">From the stubbornness of the team that rejects simple features (protected, overloads) that are not ECMA-6, i deduce that such your vision will remain a dream, unless you fork the sources and start building something different.</div> <div style="">Ironically typescript is built for large codebases, but for me, coming from C# it lacks OOP abstractions that ensure correctness: protected, internal modifiers, private members with same name, calling base member etc...</div> <div style=""><br> </div> <div style=""><br> </div> </div> <div><br> <br> <div>On Thu, Jan 31, 2013 at 4:49 PM, davidhanson90 <span dir="ltr">&lt;<a href="mailto:notifications@codeplex.com" target="_blank">notifications@codeplex.com</a>&gt;</span> wrote:<br> <blockquote style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex"> <div> <p>From: davidhanson90</p> <div>I'm currently using typescript for my projects and I must say I really love it. I'm very excited about its future and look forward to lots of new features as they come online. However one thing that I think TypeScript could really benefit from is a nuget style plugin for the language features. My reasons for this is that it seems there are two schools of thought on the direction of TypeScript. One school asks that TypeScript stays close to javascript and that language enhancements should map closely to the outputted code and that ECMA-6 is the guiding factor. The other school is looking for new features in the language which are in conflict with the first such as Async/Await support. I think its likely that a feature such as Async/Await would be very useful to a lot of devs, but those fighting the &quot;its hiding javascript&quot; fight will probably be put off. So perhaps the solution is to build typescript in a way so that we can choose the features we want in our apps. If we are happy with async /support and generics we could simple choose those options. They could be downloadable macro's which plugin to the language and compiler? Anyway its' just a thought, would be good to hear what others think. </div> <div> <p>Read the <a href="http://typescript.codeplex.com/discussions/431551#post994691" target="_blank"> full discussion online</a>.</p> <p>To add a post to this discussion, reply to this email (<a href="mailto:typescript@discussions.codeplex.com?subject=[typescript:431551]" target="_blank">typescript@discussions.codeplex.com</a>)</p> <p>To start a new discussion for this project, email <a href="mailto:typescript@discussions.codeplex.com" target="_blank"> typescript@discussions.codeplex.com</a></p> <p>You are receiving this email because you subscribed to this discussion on CodePlex. You can <a href="https://typescript.codeplex.com/subscriptions/thread/project/edit" target="_blank"> unsubscribe or change your settings</a> on codePlex.com.</p> <p>Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at <a href="http://codeplex.com" target="_blank">codeplex.com</a></p> </div> </div> </blockquote> </div> <br> </div>
Jan 31, 2013 at 6:25 PM
So many other languages support macros as part of the language. Two I can think of are c++ and the more modern clr based Nemerle. I think it's possible. And maybe that's what typescript needs, macro support.

The web community has shown many times over that they can create some compelling solutions to problems, jquery plugins are a good example, or the many many cool js libraries we have today.

Macro support in typescript would open the door to that and could hugely improve adoption.
Feb 1, 2013 at 8:21 AM
Compiler is open sourced, why do you need macros? Just change the compiler.
Feb 1, 2013 at 3:07 PM
Edited Feb 1, 2013 at 3:08 PM
Forking the compiler to add some particular language feature is not really a workable long-term solution for more reasons than I can possibly specify.

Interesting idea about implementing specific features as plugins. I don't know if it would work, but I agree that it's a shame that we're missing out on a whole bunch of useful language features just because the ECMA6 committee can't be brought to their senses.

Perhaps the release (and eventual implementation) of ECMA6 will actually free up TS to be a real alternative. If folks want strict adherence to ECMA6, well, they can write their code in ECMA6. If folks want a modern language, they can write their code in TS. That is, if TS will accept its destiny.
Feb 1, 2013 at 4:05 PM
So I remember Anders once saying he didn't want to see macros in c#. I'm wondering how he feels about it happening in TypeScript?
Feb 1, 2013 at 4:10 PM
<div dir="ltr">I hope i'll see the day when cool features like syntactic macros or at least string interpolation will be seen in C#. <div style="">My fear is, that this will happened only when Anders will ... let go. He is an extraordinary person, and C# is an extraordinary language which becomes more and more conservative as times passes....</div> <div style=""><br> </div> <div style="">The same is valid about Typescript.</div> <div style=""><br> </div> <div style="">But there is hope, open minded folks are in charge with F# where one sees a glimpse in what geekness can do to a language....</div> <div style=""><br> </div> </div> <div><br> <br> <div>On Fri, Feb 1, 2013 at 7:05 PM, davidhanson90 <span dir="ltr">&lt;<a href="mailto:notifications@codeplex.com" target="_blank">notifications@codeplex.com</a>&gt;</span> wrote:<br> <blockquote style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex"> <div> <p>From: davidhanson90</p> <div>So I remember Anders once saying he didn't want to see macros in c#. I'm wondering how he feels about it happening in TypeScript?</div> <div> <div> <p>Read the <a href="http://typescript.codeplex.com/discussions/431551#post995293" target="_blank"> full discussion online</a>.</p> <p>To add a post to this discussion, reply to this email (<a href="mailto:typescript@discussions.codeplex.com?subject=[typescript:431551]" target="_blank">typescript@discussions.codeplex.com</a>)</p> <p>To start a new discussion for this project, email <a href="mailto:typescript@discussions.codeplex.com" target="_blank"> typescript@discussions.codeplex.com</a></p> <p>You are receiving this email because you subscribed to this discussion on CodePlex. You can <a href="https://typescript.codeplex.com/subscriptions/thread/project/edit" target="_blank"> unsubscribe or change your settings</a> on codePlex.com.</p> <p>Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at <a href="http://codeplex.com" target="_blank">codeplex.com</a></p> </div> </div> </div> </blockquote> </div> <br> </div>