this post was submitted on 08 Oct 2023
28 points (72.6% liked)
Programming
17326 readers
239 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
This comment just seems weird no matter which angle I try to approach it from.
It's over a decade old now. I wouldn't call that immature.
Looking at your linked comment...
hello.ts
containing:console.log("hello world");
deno run hello.ts
(time taken to run command: 0.037s)Yes, that tends to happen as ecosystems evolve over time. Typescript allows developers to use modern standards-compliant modules, while maintaining backwards compatibility for older code.
One of typescript's strengths is that its type system isn't all or nothing. Typescript will support duck typers, but it isn't forced or limited to that. You can add as much or as little typing as you want. In theory, this means that the language supports simple beginners up to experts creating turing-complete theorem solvers at compile time. In practice, this means a much smoother onboarding and porting experience.
I'm not sure if this is the basic problem challenge or the hello world example was. It seems a bit ambiguous as to what you really want, but it's easy to create a module that takes inputs and produces outputs while running on backend servers, in browsers, and in CLIs.
Obviously the actual programs are trivial. The question is, how are the tools supposed to be used?
So you say to use
deno
? Out of all the tutorials I found telling me what tools to use, that wasn't one of them (I really thought this "typescript" package would be the thing I was supposed to use; I just checked again on a hot cache and it was 1.7 seconds real time, 4.5 seconds cpu time, only 2.9 seconds if I pin everything to a single core). And I swear I just saw this week, people saying "seriously, don't use deno". It also doesn't seem to address the browser use case at all though.In other languages I know, I know how to write 4 files (the fib library and 3 frontends), and compile and/or execute them separately. I know how to shove all of them into a single blob with multiple entry points selected dynamically. I know how to shove just one frontend with the library into a single executable. I know how to separately compile the library and each frontend, producing 4 separate artifacts, with the library being dynamically replaceable. I even know how to leave them as loose files and execute them directly (barring things like C). I can choose between these things all in a single codebase, since there are no hard-coded project filenames.
I learned these things because I knew I wanted the ability from previous languages I'd learned, and very quickly found how the new language's tools supported that.
I don't have that for TS (JS itself seems to be fine, since I have yet to actually need all the polyfill spam). And every time I try to find an answer, I get something that contradicts everything I read before.
That is why I say that TS is a hopelessly immature ecosystem.
It sounds like to me that you've taken your knowledge of your commonly used languages for granted, and assumed a new language would be just as easy. But if you watch a developer who is dipping their toe into that ecosystem for the first time you'll find them making mistakes and running into footguns you didn't know were possible.
Regardless of the language, not having a proper guide leaves devs susceptible to the incorrect blogospam that's out there, where engagement is rewarded over correctness.
Ignore all of the blogospam.
The two things you need to know:
Here's my shortened version of number 2.
The beginning:
The false start:
The resumption:
async
/await
/Promise()
syntax sugaring, to make asynchronous programming easier...
(rest/spread operator) syntax sugaring, to make destructuring and variadic functions easier??
Nullish coalescing operator syntax sugaring??=
/&&=
/||=
Logical assignment syntax sugaringThe current state of things
Language-wise
Runtime-wise
Standard workflow
Tooling wise
For your simple fibonacci example:
console.log()
and see result in browser's console.Deno.serve()
and see result in network requests/responsesconsole.log()
and see result in terminal