Live data from Hacker News

PR that converts the TypeScript repo from namespaces to modules

github.com

141–150 of 204 posts

Re: PR that converts the TypeScript repo from namespaces to modules

#141
post #114

Earlier quoted context omitted.

"Tabs vs spaces" is often misunderstood (and falsely reported) as a problem of preference. The real problem is that using spaces for indentation is an accessibility issue. The solution is to use tabs for indentation, and spaces for alignment.

Why would you ever mix them?! Even when I started programming 15 years ago it was already accepted wisdom that that was a terrible idea.

The basic idea is that you use tabs to align "blocks" (ie, multiple lines at the same indent level), and then spaces from there to align line "elements")

Aligning lines in the same block

    ____var a; // indented with a tab
    ____var b; // indented with a tab
Aligning elements of a line with the previous line

    ____var a, // indented with a tab
    ____----b, // indented with a tab, then aligned using spaces
The idea being that tabs are used where it makes sense that you could change them for preference and not have things look wonky... and then spaces are used in situations where a specific number of characters is necessary.

Another alternative is elastic tabs, where tabs are used for both of those, but are converted to an indentation/alignment number of characters semantically. I like the idea, but I've yet to see a good implementation.

Personally I'm a fan of all spaces, but that's mostly because every company I've worked at has used that.

Re: PR that converts the TypeScript repo from namespaces to modules

#142

After this change, the TypeScript compiler will now be compiled with esbuild. I feel like thats probably the best endorsement esbuild could get, hah. Surprising they call out the 2 space indent level that esbuild is hardcoded[1] to use as a benefit. Why not save even more bytes and re-format the output to single tab indentation? I wrote a simple script to replace the indentation with tabs. 2 indent size: 29.2MB, tabb…

Reminds me of Silicon Valley (HBO) where Richard uses “we are a compression company” to justify using tabs over spaces. Ironically once gzip compressed I doubt it would make any difference.

Re: PR that converts the TypeScript repo from namespaces to modules

#143
post #118

Earlier quoted context omitted.

Not everyone with vision or vision processing issues is blind. Being able to configure custom tab stops is an easy way to control what level of indentation is useful and clear.

As with all other types of data: the right approach is for model and presentation to be separable concerns. We're struggling with the wrong problem if we aren't asking why the editor can't treat blocks as entities that are displayed however we want.

https://nickgravgaard.com/elastic-tabstops/

Re: PR that converts the TypeScript repo from namespaces to modules

#144
post #63

Earlier quoted context omitted.

I can see this is probably a calm point that will definitely not escalate, programmers don't really care about tabs and spaces that much, right???

"Tabs vs spaces" is often misunderstood (and falsely reported) as a problem of preference. The real problem is that using spaces for indentation is an accessibility issue. The solution is to use tabs for indentation, and spaces for alignment.

I used to tout "tabs for indentation, spaces for alignment" until I started working primarily woth lisps. Idiomatic lisp indention isn't compatible with regular tab-stops, so the only solution is to go with spaces (maybe losing accessability) or, preferably, to go elastic.

https://nickgravgaard.com/elastic-tabstops/

Re: PR that converts the TypeScript repo from namespaces to modules

#145

Earlier quoted context omitted.

So you are saying that using a tabstop of eight to align this: -------->coolFun(arg1, -------->------->arg2) Would still look nicely aligned with a tabstop of 4? and 2? Clearly that will not look right.

You're misquoting yourself.

I don't know what your point is then, but this is turning in to a very trite conversation.

Re: PR that converts the TypeScript repo from namespaces to modules

#146
post #103

Earlier quoted context omitted.

Someone who comes onto a project and actually wants to charge money to sit there and convert tabs to spaces or vice versa. Incredible.

My attitude is generally "Which one, pick one, this one, classic"

Or like, cool, this is the code style. I don't care if it's sublime or stinks to heaven. When we get to a total rewrite we'll address that. Which features are you hiring me to implement? Which bugs need to be fixed? How can I not waste my time or yours?

Seriously, this takes yak shaving to a whole new level.

Re: PR that converts the TypeScript repo from namespaces to modules

#147
Thanks for doing this!

I reported typescript install size issue back in 2018 and changing to modules seemed to have the biggest impact here!

https://github.com/microsoft/TypeScript/issues/23339

For anyone curious, TS 1.0 was 7MB and today it’s 65MB.

https://packagephobia.com/result?p=typescript%401.0.1%2Ctype...

Really excited to see this number move in the downward direction for a change :)

Re: PR that converts the TypeScript repo from namespaces to modules

#148
post #147

Thanks for doing this! I reported typescript install size issue back in 2018 and changing to modules seemed to have the biggest impact here! https://github.com/microsoft/TypeScript/issues/23339 For anyone curious, TS 1.0 was 7MB and today it’s 65MB. https://packagephobia.com/result?p=typescript%401.0.1%2Ctype... Really excited to see this number move in the downward direction for a change :)

These days, it's tracked at https://github.com/microsoft/TypeScript/issues/27891.

I have a gameplan to drop this by another 7 MB (by turning our executables into ESM), probably for 5.0 as well if we decide that Node versions older than 12 are worth dropping.

Re: PR that converts the TypeScript repo from namespaces to modules

#149
post #63

After this change, the TypeScript compiler will now be compiled with esbuild. I feel like thats probably the best endorsement esbuild could get, hah. Surprising they call out the 2 space indent level that esbuild is hardcoded[1] to use as a benefit. Why not save even more bytes and re-format the output to single tab indentation? I wrote a simple script to replace the indentation with tabs. 2 indent size: 29.2MB, tabb…

I can see this is probably a calm point that will definitely not escalate, programmers don't really care about tabs and spaces that much, right???

In soviet python, runtime cares

(if you accidentally use a tab in a file that otherwise uses spaces, you get a runtime exception, or vise versa)

Re: PR that converts the TypeScript repo from namespaces to modules

#150

After this change, the TypeScript compiler will now be compiled with esbuild. I feel like thats probably the best endorsement esbuild could get, hah. Surprising they call out the 2 space indent level that esbuild is hardcoded[1] to use as a benefit. Why not save even more bytes and re-format the output to single tab indentation? I wrote a simple script to replace the indentation with tabs. 2 indent size: 29.2MB, tabb…

Does that mean they are not using type checking? That’s the really really slow part of writing TS and es build doesn’t include it, which is why I’ve never seen the point of using esbuild as a compiler.
Post reply on HN