Menu
Sign In Search Podcasts Libraries Charts People & Topics Add Podcast API Blog Pricing

Anders Hejlsberg

๐Ÿ‘ค Speaker
701 total appearances

Appearances Over Time

Podcast Appearances

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

And then we have an optional stage at the end called our emitter.

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

And normally the emitter infrastructure in a compiler is also quite big because that's where you go from intermediate representation to machine code.

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

or bytecode.

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

Now, in our case, we just erase types, if you will.

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

Well, we kind of do two things in our compiler, actually.

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

Early on, it was very much about A, erasing the types, but B, also down-leveling your code.

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

So we would take newer ECMAScript features that weren't yet supported by the runtimes, for example, classes, and then we would down-level them to constructor functions and whatever.

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

And so we would rewrite the code.

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

And that was a very popular feature early on.

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

Now,

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

Pretty much every browser is evergreen and, you know, like ECMAScript features are caught up.

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

And so that's not as important anymore.

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

So our emitter is effectively, you know, a thing that just erases type annotations and spits out the JavaScript code that can run unannotated and also can spit out declaration files, which are summaries of your modules and so forth.

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

But those are sort of the stages.

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

Now, the thing that's interesting about the compiler though, is that it's built in a manner that, where it can function in a highly interactive mode, which is what the IDE uses.

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

Normally, you know, command line compilers, they just run through these stages and, you know, the output is just whatever gets emitted or some error messages, right?

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

But in an IDE, you know, the compiler is a service and what we do in that service is

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

We basically take a program that is perpetually broken because you're typing.

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

And yet we try to syntactically or semantically analyze it.

The Pragmatic Engineer
TypeScript, C# and Turbo Pascal with Anders Hejlsberg

And because we need to know when you press dot here, what could come next?