Live data from Hacker News

Deno 1.0

deno.land

141–150 of 598 posts

Re: Deno 1.0

#141
post #118

Earlier quoted context omitted.

It's just a URL right? So could you not mirror the packages to your own server if you're so concerned, or better yet import from a local file? Nothing here seems to suggest that packages must be loaded from an external URL.

> 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.

Re: Deno 1.0

#142

As a functional developer who doesn't care for TypeScript in any way, it's frustrating to see Deno has it "built-in". As a node developer writing pure none-compiled JavaScript, my run time is extremely fast from changing code to seeing its results. It takes milliseconds for me to run brand new code in my terminal. If I make an index.ts file simply adding two numbers together (with no TypeScript), there is a 1 to 2 se…

> As a node developer writing pure none-compiled JavaScript, my run time is extremely fast from changing code to seeing its results. It takes milliseconds for me to run brand new code in my terminal.

Deno runs JavaScript faster than node:

   echo "console.log(1 + 2)" > not-ts.js
   time deno run not-ts.js
   3
   0.01s user 0.01s system 89% cpu 0.025 total
   time node not-ts.js
   3
   0.03s user 0.08s system 53% cpu 0.203 total
> Since it's not even native TypeScript, it's just embedded the tsc which builds and caches the compiled code, why not let TypeScript developers add their bundling pipeline in the same way as they've always done.

You can!

Re: Deno 1.0

#143
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.

Node v14 supports ESM modules and the import syntax, which is standard Javascript.

Re: Deno 1.0

#144

Does anyone else see the import directly from URL as a larger security/reliability issue than the currently imperfect modules? I'm sure I'm missing something obvious in that example, but that capability terrifies me.

I thought a lot about it, and it seems as secure as node_modules, because anybody can publish to npm anyway. You can even depend to your non-npm repo (github, urls...) from a npm-based package.

If you want to "feel" as safe, you have import maps in deno, which works like package.json.

Overall, I think Deno is more secure because it cuts the man in the middle (npm) and you can make a npm mirror with low effort, a simple fork will do. Which means you can not only precisely pin which code you want, but also make sure nobody knows you use those packages either.

Take it with an open mind, a new "JSX" or async programming moment. People will hate it, then will start to see the value of this design down the road.

Re: Deno 1.0

#145
post #137
post #127

Earlier quoted context omitted.

Ah, in this case, I would then have to commit my dependencies into my VCS to maintain reproducible builds. I'm not sure I like that solution very much either. I've seen node_modules in multiple GBs, and I'm sure Deno's dependency sizes are going to be similar.

In practice modules will be available from sources that will have similar reliability to npm: github.com, unpkg.com, cdn.pika.dev, jspm.io, etc.

it's better because there will be more choice.

Re: Deno 1.0

#146
post #142

As a functional developer who doesn't care for TypeScript in any way, it's frustrating to see Deno has it "built-in". As a node developer writing pure none-compiled JavaScript, my run time is extremely fast from changing code to seeing its results. It takes milliseconds for me to run brand new code in my terminal. If I make an index.ts file simply adding two numbers together (with no TypeScript), there is a 1 to 2 se…

> As a node developer writing pure none-compiled JavaScript, my run time is extremely fast from changing code to seeing its results. It takes milliseconds for me to run brand new code in my terminal. Deno runs JavaScript faster than node: echo "console.log(1 + 2)" > not-ts.js time deno run not-ts.js 3 0.01s user 0.01s system 89% cpu 0.025 total time node not-ts.js 3 0.03s user 0.08s system 53% cpu 0.203 total > Since…

> Deno runs JavaScript faster than node

Yup, and that's really cool and exciting. My issue isn't with runtime timing. That's not what costs me money. Developer time is what costs money, and every change having to "recompile" my already raw JavaScript costs way more than saving 0.02s at runtime.

Re: Deno 1.0

#147
post #127

Earlier quoted context omitted.

Hi! The response to your fears are in the announcement. "If you want to download dependencies alongside project code instead of using a global cache, use the $DENO_DIR env variable." Then, it will work like node_modules.

Ah, in this case, I would then have to commit my dependencies into my VCS to maintain reproducible builds. I'm not sure I like that solution very much either. I've seen node_modules in multiple GBs, and I'm sure Deno's dependency sizes are going to be similar.

To solve your issue, you would do exactly how you do your node deployments: download the deps in a folder in CI, then deploy the whole build.

Re: Deno 1.0

#148
post #121

Earlier quoted context omitted.

I'm wondering about the practicality of importing from URLs. I didn't see it addressed, but an import like this will be awfully hard to remember. import { serve } from "https://deno.land/std@0.50.0/http/server.ts"; Anyone know if there are alternatives or a plan for this aside from "use an IDE to remember it for you"?

The convention is to make a `deps.ts` and re-export what you need. Like this: https://deno.land/x/collections/deps.ts I don't find versioned URLs much more difficult to work with than package@ though.

i'm wondering if they'll end up adding a 'dependencies.json' to eliminate the boilerplate from 'deps.ts' and to simplify tooling. that'd be revolutionary! ;)

jokes aside, i wonder how import-via-url will impact tooling. having to parse arbitrary JS (or even run it, for dynamic imports?) seems like it'd make writing a "list all dependencies" tool much harder than a "dumb" JSON/TOML/whatever file would. though i guess Go does a similar thing, and afaik they're fine

Re: Deno 1.0

#149
> 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 dependencies-as-URLs, I don't mind it, and may prefer it. I've been experimenting with minimizing my dependencies lately, and vendoring them in git submodules. It's worked fairly well.

[0]: https://github.com/pull-stream/pull-stream

[1]: https://github.com/reactive-streams/reactive-streams-jvm

[2]: https://github.com/omnistreams/omnistreams-spec

Re: Deno 1.0

#150
post #148
post #121

Earlier quoted context omitted.

The convention is to make a `deps.ts` and re-export what you need. Like this: https://deno.land/x/collections/deps.ts I don't find versioned URLs much more difficult to work with than package@ though.

i'm wondering if they'll end up adding a 'dependencies.json' to eliminate the boilerplate from 'deps.ts' and to simplify tooling. that'd be revolutionary! ;) jokes aside, i wonder how import-via-url will impact tooling. having to parse arbitrary JS (or even run it, for dynamic imports?) seems like it'd make writing a "list all dependencies" tool much harder than a "dumb" JSON/TOML/whatever file would. though i guess…

Well they do have import maps! I think everyone likes shorthand package names.
Post reply on HN