Live data from Hacker News

Deno 1.0

deno.land

351–360 of 598 posts

Re: Deno 1.0

#351
post #118

Earlier quoted context omitted.

> or better yet import from a local file And this is different from NPM how? Except that I've now lost all the tooling around NPM/Yarn.

It's different because it doesn't rely on require() which is non-standard JavaScript.

setTimeout is non-standard JavaScript too but I bet your code base has multiple instances of its usage.

Re: Deno 1.0

#352
post #199

Earlier quoted context omitted.

Deno really shouldn't run TypeScript files directly. Not only is TypeScript too slow for this, it receives far too many breaking changes. How will Deno decide when to upgrade its TypeScript compiler version? Will Deno have to have breaking changes every three months or so? Also, Deno appears to allow import TypeScript files with .ts extensions while tsc doesn't. This alone means the same code won't run in Deno and co…

I’m a huge TS fan and I agree. Deno is just running tsc for me it seems. So far I don’t see much advantage. It also potentially ties Deno to current trends. TS is pretty dang popular, but what if something else comes along and scoops it?

I read in a comment somewhere else in this post that you can just point deno at JS files to skip the TS compiler. I agree it's probably not a good idea to couple the Typescript version with the runner.

Re: Deno 1.0

#353

Earlier quoted context omitted.

There are a lot selling points. To me, the main one is typescript with no build.

Clearly they have never dealt with JavaScript build tools and npm. A complete nightmare.

Who hasn't? Isn't this precisely one of the pros of Deno?

Re: Deno 1.0

#354

Earlier quoted context omitted.

The whole idea of a URL is that it’s a standardized way of identifying resources in a universally unique fashion: if I call my utility library “utils”, I’m vulnerable to name collisions when my code is run in a context that puts someone else’s “utils” module ahead of mine on the search path. If my utility module is https://fwoar.co/utils then, as long as I control that domain, the import is unambiguous (especially if…

Allow me to provide an extremely relevant example (medium sized code base). About 100 python files, each one approximately 500-1000 lines long. Imagine in each one of these files, there are 10 unique imports. If they are URLs (with version encoded in the URL): - How are you going to pin the dependencies? - How do you know 100 files are using the same exact version of the library? - How are you going to refactor depen…

Yeah, I agree, but that intermediate lookup table (a) can be in code and (b) can involve mapping local package names to url package names.

One off scripts would do `from https://example.com/package import bar` and bigger projects could define a translation table (e.g. in __init__.py or similar) that defines the translation table for the project.

Embedding this sort of metadata in the runtime environment has a lot of advantages too: it’s a lot easier to write scripts that query and report on the metadata if you can just say something like `import deps; print( deps.getversions(‘https://example.com/foo’)`

One of the best parts about web development is that, for quick POC-type code, I can include a script tag that points at unpkg.com or similar and just start using any arbitrary library.

Re: Deno 1.0

#355
post #266

Earlier quoted context omitted.

We need to distinguish between npm, the service ( https://www.npmjs.com/ ) and npm, the tool. Deno has the functionality of npm, the tool, built-in. The difference is that like Go, Deno imports the code directly from the source repository. In practice it's going to be github.com (but can be gitlab or any code hosting that you, the author of Deno module, use). NPM is a un-necessary layer that both Go and Deno has remo…

How do you list the dependency libraries if you don't have a package.json? Do you manually install a list of libraries provided by the author's readme?

The dependencies are imported in the source code of the package.

Re: Deno 1.0

#356
post #89

>> Internally Deno uses Microsoft's TypeScript compiler to check types and produce JavaScript. Compared to the time it takes V8 to parse JavaScript, it is very slow. >> We certainly think there are improvements that can be done here on top of the existing TypeScript compiler, but it's clear to us that ultimately the type checking needs to be implemented in Rust. Funny, I was just talking about something like this in…

> I don't understand why Microsoft doesn't have their own native TypeScript runtime engine by now what would they do with it? ship it in Edge? great, now some small fraction of users can run TS natively. but most can't, so everyone would still transpile to JS anyway... it could work if Google did it, but i don't think MS has enough market share to have an influence here

It would work for server-side tools (like Deno). For example, cloud functions on various cloud platforms often support TS.

Re: Deno 1.0

#357

> In Deno, sockets are still asynchronous, but receiving new data requires users to explicitly read() Interesting. If I understand correctly, they're essentially using pull streams[0]/reactive streams[1]. I compiled a few resources on this topic when I was digging into it a while back[2]. I've found the mental model to be very elegant to work with when needing backpressure in asynchronous systems. As for the dependen…

Is this different from how streams work in most other languages, e.g. Java, Go, Python?

Most languages block by default, so backpressure is much easier to model: just don't read until you need more data and the sender will block.

But in JS the receiving end will just keep firing off data events until you pause it, or use something like reactive streams to request data as you're ready for it.

That's my understanding of the situation at least.

Re: Deno 1.0

#358
I do a lot of django. Does anyone know if it can handle backpressure as described in the deno announcement? Or is that typically seen only in a microservices context?

Re: Deno 1.0

#359
post #303

Question: deno run https://deno.land/std/examples/welcome.ts This works - it downloads the code from that URL, then compiles and runs it. But if you visit https://deno.land/std/examples/welcome.ts in your browser you get back HTML, not raw code. Anyone know how this works? Is deno.land a special case or is there some Accept header cleverness or something going on?

Was waiting for the first person to point out that what you get when you visit a url is not guaranteed to be the exact same on a subsequent visit.

Not seeing how url-based package management is safer when a package host can use a server that sends a special payload to certain requester ips, headers, cookies or referrer.

Until there are firm guarantees around what you get from a url, a trust-able third party is needed, even if just as an option.

Re: Deno 1.0

#360
post #266

Earlier quoted context omitted.

We need to distinguish between npm, the service ( https://www.npmjs.com/ ) and npm, the tool. Deno has the functionality of npm, the tool, built-in. The difference is that like Go, Deno imports the code directly from the source repository. In practice it's going to be github.com (but can be gitlab or any code hosting that you, the author of Deno module, use). NPM is a un-necessary layer that both Go and Deno has remo…

How do you list the dependency libraries if you don't have a package.json? Do you manually install a list of libraries provided by the author's readme?

[deleted]
Post reply on HN