TypeScript is a hideous language compared to C#
and since TypeScript is compiled to Javascript anyway,
then why didn't you simply let people write in C# syntax ?
C# is easier to read and write, and well known by all the ASP.NET, WPF, Silverlight, WinRT (etc) people
The reasons why are covered in the Introduction of the Language Specification and the TypeScript Design Goals.
And what's with the Java and JavaScript people? TypeScript should be written in Python! If you don't like TypeScript/JavaScript Syntax just pick one of these https://github.com/jashkenas/coffeescript/wiki/List-of-languages-that-compile-to-JS
The reason why i ask here on Microsoft/Typescript, is because Microsoft has given us this beautiful language called C# which is more or less Microsoft's answer to Java - Write in one language, run everywhere...
TypeScript is a mutant monster in that sense...
It's syntactic ugly, introduces errors for beginners, hard to learn etc..
Had MS used C# - then at some point, we could replace the horrible language, Javascript, which is full of so many minefields...
Those are all subjective arguments...
There isn't anything realistic or constructive with you thoughts. While you may not intend it, you are just trolling.
:trollface:
The best reasons IMO:
"Why Isn't" questions are challenging because the it can be answered infinitely many ways. A better question to ask is, "what is the best language to write the typescript compiler in". Then "C#" is one _possible_ answer. You seem to assume it is the best possible answer, as a given.
For the question of "what is the best language to write the typescript compiler in", that can be answered and has been answered. And not presupposing an answer, two logical possibilities are "typescript itself" and "javascript", since those are the two languages typescript pertains to.
And given that "C#" isn't a language typescript pertains to, I want to flip this around and ask, why is C# a relevant language when it comes to typescript?
@Montago if you want to write in C# and transpile to JavaScript you can use one of the many compilers available (well, not so many). For example a good one is the Saltarelle Compiler; I've used it myself for years.
In my experience writing in C# for the web was too clumsy and verbose. You find yourself always fighting and struggling with types.
Over time I started to prefer TypeScript to C#, until one day I finally switched. It was a good choice.
Programming languages are tools; and as a developer you choose the tool that fits your project needs. I do not believe that there is a universally better language for all projects.
When we embarked on the TypeScript project, we wanted to build a toolset that is 1. cross platform, 2. open source, 3. talks to the JS community. JavaScript/TypeScript was and still is the best road for this end. Moreover bootstrapping is a very useful tool for compiler construction in general.
There is any plans to rewrite the TypeSceript compiler at the time being. closing.
@Montago enough has been said here but just wanted to point out a recent post on Script# and the migration to TypeScript to leverage the greater JavaScript ecosystem https://medium.com/@delveeng/welcome-to-delve-engineering-7d6c027c96f1#.re1r44lsj :rose:
Walker Ranger has written a few blog articles about this matter:
http://walkercoderanger.com/blog/2014/02/javascript-minefield/
his proposed syntax is pretty rotten though, and people who answered the poll didn't like it either.
BUT he has many great points of why Dart, TypeScript and CoffeeScript (and Javascript) aren't the best tools for building web applications.
What we many many developers who build huge web applications need and yearn for, are a statically typed language with easy to read, predictable code structure.
TypeScript is close - really close - but it suffers from all the pitfalls of Javascript and thereby the tools.
TS like JS is interpreted, which enabled the use of dynamic types and weak comparators.
while investigating alternatives i came up with the idea of JS becoming a browserplugin like we know it from Java runtime, Silverlight and so on... If browsers instead of hardcoding the JS runtime into the browser, instead injected it as an API, then browsers could replace the JS runtime with a C# runtime.
If that was possible, then Dart would work natively as well as C#.
I guess there's too much politics for this to ever happen
Thanks for all the answers.
Just yesterday I was on a conference and there was a speakter talking about the great possibilities JavaScript offers because it is not statically typed and why we shouldn't use TypeScript.
Stockholm syndrom ?
@DaSchTour I would love to see the slides or video of that lecture.
@Montago
As a professional JS dev, and Node.JS dev I can say one thing JS has over .net and all the other languages out there. JS is the only language that runs natively in all visual browser. Outside of NaCL for chrome. So the argument of just use C# for everything is left in the dust by the simple fact of you cant use it in the browser, and nor will it ever be supported in the browser.
"Had MS used C# - then at some point, we could replace the horrible language, Javascript, which is full of so many minefields..."
This is so far from incorrect and is why they did not do it. In what browser would C# be supported? Unless you are talking about .net compiling down into JS to support the largest market shared browser, Chrome, which supports and endorses JavaScript?
Another point would be if you use C# then you are screwed for any computer that isnt windows. You can not use the argument, just buy windows when the majority of mobile browsers are not windows based. You then cut out a large market share of people visiting most websites.
I really feel your point of view is just that of someone who really likes their language and does not understand the reasons for JavaScript.
Nothing wrong with liking C# but it isnt the only thing out there that works. If your JS is that bad, then it isnt the language, but the developer.
A wrecking ball isnt a good replacement for a hammer, or a wrench. Right tools for the right job.
@phreaknation
Why didn't you read everything before commenting ?
My argument was that, since TypeScript needs a compiler, then why not use the SYNTAX of C# instead ?
C# is almost identical - but has slightly nicer syntax and an even stronger type-control
I never suggested that .NET should run in the browser ..
The designer thought out another syntax for TypeScript, but it didn't work. It is ugly to learn; JavaScript is ugly too. So, why C# doesn't replace TypeScript/JavaScript? Language is just language; can be expanded or added to fulfill anything. It is doable. Can someone list one task that TypeScript/JavaScript can do, but C# cannot? Remember, Language can be only simplified to a certain degree; otherwise, easy to have errors for multiple reasons, then no good. So, C# isn't verbose in term of readability and rightness.
Really every language after Plankalkül has been a waste of time. Once we got one Turing-complete language, we should have just stopped.
Just need a new browser which can interpret C# other than JacaScript; so simple
@Montago I actually did. read it all out.
I have yet to see a C# application be as graceful in the UI area as a lot of JS applications. Does not mean there isn't. Also C# is just now becoming available on all systems which means it would limit what systems it would go on top of. Microsoft has tried something similar.
The real question is, what is the issue with using JavaScript?
I know you are saying, why not write C# vs typescript, but if typescript is an issue for you, even though it isnt meant to be a 1 to 1 for C#, then why not write pure JS instead?
C# isnt the end all be all. It is good, and good for a lot of people but I for one think its pretty clunky and gets in the way of the developer more so than other languages out there. Then again I do know a few languages and I am currently relearning C. It is more about use what is best for you. If you do not like TypeScript, there are a few other choices, coffeescript is one, but you seem like you prefer a strict typed language over more of the RAD style'd ones.
You also mentioned the mindfields of JS. Every language has that. You have a Biased towards C#, but as someone who has had to support C# I have ran into a few in C#. Of which is you can never pull up a legacy C# app and just run it. C# is also a minority which means good developers for C# are just rare.
C# has only recently been able to run on other systems and that is stripped down version of C# so your comment about answer to Java is incorrect. Heck, JavaScript has more portability than C# does.
If TS was written as C# it would still take years before it could even possibly over take JS, and with the new ES6 and ES2017 specs, that being a possibility is slim to none.
Although, do you really want the company who brought you Trident to be stream lining your browser interpreter? I doubt that.
@Montago If you want to use the syntax of C#
why not to use C#
? You probably misunderstood what is the idea behind Typescript
.
This thread isn't going to go anywhere useful at this point
Most helpful comment
The reason why i ask here on Microsoft/Typescript, is because Microsoft has given us this beautiful language called C# which is more or less Microsoft's answer to Java - Write in one language, run everywhere...
TypeScript is a mutant monster in that sense...
It's syntactic ugly, introduces errors for beginners, hard to learn etc..
Had MS used C# - then at some point, we could replace the horrible language, Javascript, which is full of so many minefields...