Lurker News

Comments (191) 32 threads

Earlier comments
cjdell3 replies#
I had no idea you could compose string literal types AND infer variables using interpolation syntax in the context of conditional types.

I am salivating at the potential use cases for this...

ricksharp#
Right! That is insane - I had no idea it was possible to infer part of a string literal.

My mind is exploding at the possibilities.

cjdell#
Lots of new toys to play with in this release! They've also explained each new feature really well...
dixon395#
Typescript was created to bring static types in dynamic language, like JS. Now they made the static types more dynamic. What's next?)
bionhoward2 replies#
JavaScript is such a cool language, and I really love it, especially the FP subcommunity, but the AI community for Python is way bigger, I wish there were more options for neural nets, differentiable programming, and data frame type things in JS. The interoperability with WASM is hugely valuable, and so is the ability to easily publish results on the web. It feels like it’s way easier to make an AI system in python, but then you have to figure out how to monetize it, while if you use JS, you can build a web platform or service and monetize much easier. Thoughts?
ozorOzora#
I think these are two different languages for two different jobs.

I can see javascript slowly expanding from the front-end into the back-end, mostly thanks to projects like TypeScript that appeal to the back-end crowds, but also because of the whole serverless hype which IMO is justified.
Now there still is a strong "cultural divide" between the software and the data-science communities. And when you see how strong the innertia for python's projects is.. Well I guess we won't see this changing anytime soon.

yowlingcat1 reply#
I think you're talking about two different systems and two different problems. First, there's the core service code, the AI system in Python you're talking about. Then, there's the web platform or service that you monetize. But there's no reason why you wouldn't just use both.

Write the core AI code in Python because that's what's practical to do. Write the app code in JS because that's what's practical to do. Sell the product to customers that want to use it and probably don't care what's underneath.

mewpmewp2#
In my opinion it would be great to have a single language for developer productivity. Backend and frontend can be already written fully in TypeScript and you can share interfaces between frontend and backend so everything is connected and business logic is not repeated. Same thing could be done for machine learning.

If backend changes frontend has to change as well or compiler will yell. Same for machine learning input and output.

flowerlad3 replies#
This shows how complex TypeSript has become. It may be fun to write complicated Type annotations such as this, but imagine having to read and maintain the code!
smt881 reply#
From years of real-world experience, it's rare to run into types that are too complex to easily understand. The syntax is pretty easy to read, and the compiler and language service make it easy to navigate types, even if you haven't looked at the source for them yet.
alangpierce2 replies#
FWIW I find that TypeScript types can sometimes be overwhelming or hard to decipher, especially some third-party library type definitions. The connect function from react-redux is one example:

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/d07d...
Since types can get really complex, I feel a need to be conscious of avoiding complexity when writing types myself, unless the value is enough to justify a hard-to-read type.

freeqaz#
This is the complexity introduced when applying static types to a vanilla JS codebase, imo. It's easy to get crazy with types in vanilla JS. Adding Typescript forces you to resolve the different types explicitly and it can get hairy.

What this really demonstrates to me is the difference between starting with TS vs migrating to it. Code that has to think about the types the first time it is being built is going to be better structured, on average, than purely dynamic code.

eyelidlessness#
Many complex/difficult to understand TS types exist precisely because the type system was too limited to express certain real world use cases without workarounds. As the type system takes on that complexity, and removes more limitations, it actually makes writing simpler types for those cases much easier.
searchableguy#
From ts conf talks, only a minority of people actually write most of the complex types. Those are mainly library authors and such, I presume.

https://youtu.be/jmPZztKIFf4 at 49:50.

bhandziuk#
I find these types still exist in JS it's just impossible to decipher what you're writing and supposed to be doing without a solid TypeSystem. The types might look complicated but really this is much more simplified that getting runtime errors.
aleksjess#
> a database implemented purely IN TS

Ok, we might have went a bit too far

Load more comments