I think web browser has more mistakes than node.js
Deno is here to support and conform to web standards.
if you don't like the standards, this would be the wrong place to complain to.
I am not dislike the standards, I think atob/btoa exist for some reasons.
I wonder will deno support as much web standards as possible, regardless it is good or bad part.
For example, offline screen canvas, dom, and become another puppeteer.
Is this for running every javascript that was written for browser in deno?
Why not implement all file api in the core conform to the https://developer.mozilla.org/en-US/docs/Web/API/FileSystem
I previously think deno is to fix the mistake of nodejs / reimplement nodejs in modern way. atob/btoa are not that modern.
Nodejs has many mistakes, but it doesn't pollute the global namesapce.
When we approach a problem to solve, like base64 encoding a string, we look to the browser standards to see if there is a reference, and if so implement that API. This opens up opportunities for more code to run in Deno and a browser without having to change that code.
We will likely introduce the FileSystem APIs. They are still experimental technology and it isn't clear if the standards are going to hold, which is why we haven't but instead introduced the APIs in the Deno namespace.
Node.js does pollute the global namespace... require, process, global to name a few. It invented those, and made whole classes of code that is really difficult to get to run in Node.js and a browser, instead of embracing browser standards, something that Deno aims to address. Deno keeps all of its non standards based globals limited to the Deno namespace.
Will you actually use atob/btoa to do base64 encoding? Base64 is an encoding between binary and string, not string to string. Do you think atob/btoa are bad apis?
I agree with you about FileSystem API. Maybe I should make another example.
In nodejs, only process I think it is a pollution. But it is a history, maybe early nodejs' mistake. TextDecoder, TextEncoder, URL, URLSearchParams maybe pollution especially for URL it's short and common.
Deno is to fix the nodejs, will it fix web? Or for compatibility, deno will accept every web apis?
I agree with you that if you want some api, it is good to use exsiting standards to implement. fetch, TextEncoder, TextDecoder are good examples, they deserve in the global, once you fully implement them. atob and btoa are not, except for compatibility.
My English is not good, I hope you can understand me.
Will you actually use
atob/btoato do base64 encoding?
Yes.
You have a funny definition of "pollution". I would not consider following browser standards pollution. They are agreed standards, even if you personally don't agree with them.
I am not sure what outcome you are expecting out of this. atob and btoa are implemented, they are based on the browser standards. If you don't like them, don't use them and if it really offends you too much, you might want to consider not using Deno.
I don't like atob and btoa is becuase they use string to represent binary data. I don't know why not use ArrayBuffer or typed array, except for compatibility. In deno, the binary data is type array everywhere. Do you really want convert them between string using fromCharCode and charCodeAt? Or you think all strings only contain ascii characters. Summary: atob and btoa are not base64 encoding functions.
I think everything in the global namespace are pollution. Many of them come from javascript I can't say much of them, because it is history or some of them are core language feature.
Modern javascript has module system. Should use it as much as possible. Don't say the old web standards. Deno is a new thing. Of cause I'm not saying don't follow the web standards. I mean don't follow them only becuase they are standards. For example, canvas is useful. Even a server program need to process the image file. Will deno eventually implement canvas api in the core? I think it's not suitable.
I am closing this. Because it's hard for me to write English, I can't express me very well. The argument is not necessary for deno. I will keep looking at deno. And hope it grow to a wonderful thing.
Most helpful comment
Deno is here to support and conform to web standards.
if you don't like the standards, this would be the wrong place to complain to.