-
Notifications
You must be signed in to change notification settings - Fork 639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reorg #76
Comments
Very much approve of this issue/cleanup but Not a huge fan of "utils". What is the logic for putting datetime there? What else is a util? |
datetime is very small... seems to not deserve its own directory. I agree it seems odd that its the only "util". I will remove it from the above list. Maybe we can do that later when there are more utilities. |
I've also updated the above list with these suggestions. |
Please let me express the opposite opinion. I understand we need some consistent style or rule about module file's naming. However, in my opinion, |
I believe a collection of modules, something we would put in |
Thank you for the opinion! From style guid, I understand mod.ts was ported from Rust's unofficial module convention. I doesn't know much about Rust, so looked around some famous rust codes on Github. Even in rust community, mod.rs (or lib.rs?) doesn't looks predominant idea for representing module entry file, for me. For example, ring, the famous crypto library, has decided to stop using mod.rs just 27 days ago (briansmith/ring@69cc075) because As @kitsonk says, Some developer may need "default" entry file for modules. But Go doesn't have, but succeeding because of a type and module system designed based on URL-like. Thanks to the modern intelligent editor, importing classes, functions and constants is very easy today. The only thing developer must know is component name not entry file's url. In my opinion, why the entry file that is composed of all internally exposed component from other files was needed, is classic programming languages couldn't import module directly from URL! (like ruby, python and npm do) I believe deno's module system based on URL is pretty nice. If mod.ts were implicitly required, It means that mod.ts can be omitted. On the other hand, I understand that It is difficult to create "package-private" (not desirable to be public) components in deno's module system. But that is ES/TS Module' problem. There must be another solution. Thanks! |
@keroxp makes a good point. I suggested mod.ts as an alternative to using index.ts - but a more minimal solution would be to simply suggest people to avoid index.ts in the style guide. |
Ring/that issue has a history, see briansmith/ring#598 etc. We're also not talking about a mod.ts for each file which is what ring maintainer took exception to with mod.rs. In deno you can use relative imports trivially within a project. ring still uses lib.rs which is what this is more analogous to imo. If there are several files a mod.ts exposing all of them is a reasonable and offers standard entry point to a public API for the repo. I'm very much in favor of this consistency (at least within std) |
Sure, I let it decided totally by @ry In deno_std,
|
The duplicate suggestions part sounds more like a problem with the editor itself. It might be possible that the editor could prefer exports from As to Also, I am somehow against package private design implemented by Deno but not present in ES/TS standards/proposals with positive feedbacks (opposite to things like |
I believe this is something that could be added to deno_ls_plugin fairly easily. I think re-ordering (versus eliminating) would be best.
I agree with this wholeheartedly. |
I disagree with it. It is difficult to judge which file are prior exportation about it without any "rule". There must be some configurations about module resolution priority for the editor. Now I agree It is convenient that there are files somehow collect api, so could you let me suggest another reorg style on this repository? As @ry said, if
I think It is not desirable there are many And I am also impressed that For example, if there could be importing like this:
then
I agree with it. I also think that It is desirable there are no deno's specific module rule against ES/TS module. |
@keroxp fyi extensionless support has been dropped in denoland/deno#1396 . As for other part of your argument, please give me more time to think about and I’ll reply later... |
@kevinkassimo There seems to be unmerged reorg PR with |
@keroxp I’m still collecting opinions on |
Hm, sorry but trying to keep up. Can we read somewhere about the Why not As for the automatic resolving,
I'm agree with @keroxp. In same time, I understand that it defeats the idea for URL based module system. Because one of the main ideas with Deno is to be as much as possible like in the browsers, except that it's in TypeScript. But anyway, we already have Btw, what about supporting |
@tunnckoCore I wrote about it in the style guide (README.md) of this project:
|
It isn't the browser the resolves |
So there has been an alternative proposal that I have thought of in the past and brought up again recently in discussions with some developers (including @justjavac). Since extensionless support has been dropped, there are no more conflicts between
With such directory layout, we could do import "https://deno.land/x/std/log.ts"; instead of import "https://deno.land/x/std/log/mod.ts"; There are some issues also with this approach.
import "https://deno.land/x/${module_name}.ts" However, this requires the registry to extract
Also cc @keroxp about this proposal |
Is there a clever way to do this automagically, so that:
rendered a typescript file that imported and exported everything from
... without having to actually run/parse mod.ts on the registry server. |
Generally "automagically" !== good idea... every time it bites you in the 🍑, that is the main justification for staying away from |
By "automagically" (silly word, I shouldn't have used it) I just meant populate Edit: the obvious thing to put in would be: Import * as log from './log/mod.ts';
export { log }; You can do that in the registry Lambda... |
I'm maybe open to deno.land registry hacks like that but this discussion is more about the style guide for deno in general.
I feel like the ideal situation would be if we figured out some top level categories like "fs" and "net" that we could organize into? E.G.
|
We've been adding code without much thought to the overall directory structure. I suggest the following renames:
Along with the associated tests.
If you're worried about breaking existing code:
The text was updated successfully, but these errors were encountered: