Replies: 19 comments 2 replies
-
Thanks for the question, I see you are finding the dark corners of the language! Virgil doesn't yet have a namespacing mechanism. For that, I envision allowing a single The import/export mechanism you stumbled on is currently only used for the The import/export mechanism needs some additional features to be useful on other targets. E.g. on the |
Beta Was this translation helpful? Give feedback.
-
Something like this? Top-level module statement:
Top-level import statement:
Example files:
|
Beta Was this translation helpful? Give feedback.
-
Yeah, that is roughly what I was thinking, modulo the keywords. (E.g. "import" is being used for the Wasm case that I described above--maybe want a different keyword). Another thing I have thought about is having a convention where a file |
Beta Was this translation helpful? Give feedback.
-
Wouldn't this tie language semantics to the underlying file storage mechanism? One of the neat things about Virgil is that the language is independent of file locations, file names and file ordering. In my opinion, directory layouts, file paths and URLs should be relegated to the language tools not the language. |
Beta Was this translation helpful? Give feedback.
-
It does slightly depend on the file order, because that is the order in which component initializers (and top-level initializations) are run, which is observable (e.g. you can make internal lists and such). |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I generally agree on that. E.g. I really like that the compiler's job is just "take huge list of files, generate binary" and not go hunting around for packages and other magic. For example, Wizard just has a Another idea, that does have some downsides, is that the file->module grouping could be done at the command-line level, e.g. |
Beta Was this translation helpful? Give feedback.
-
The "just compile the files" is refreshingly transparent -- no magic paths or directory layouts.
the
The LSP has revolutionised IDEs and editors to the point were "Quick fixes" like these along with auto-completion, pop-up documentation and semantic syntax highlighting are fast becoming an accepted, if not mandatory, norm. I would find it very difficult to go back to a world monochrome text-only editors.
Command-line language semantics are a bit too magical for my tastes. |
Beta Was this translation helpful? Give feedback.
-
Yeah, I think I am convinced now that at least a As for IDEs, I was a huge IntelliJ fan for many years. IDE refactoring is absolutely wonderful, particularly the more advanced things like inline/extract method, navigation, etc. I'd like to have a VSCode plugin for Virgil, complete with LSP, but every time I go down that road I stumble on the basics. I've been using Ok, another idea: if Virgil had That would still scale fairly well, as the Virgil parser is ~1-2 MLOC/s. Eventually for really big programs an incremental compilation solution would be needed. I'd want it to still "feel" like |
Beta Was this translation helpful? Give feedback.
-
Thinking about it, I'm not sure adding module/import statements is necessary or a good idea. Not only is it adding boilerplate and adding to the language, it also introduces (possibly cyclic) import recursion (these issues don't arise with the current scheme). Why not just extend the existing
This could be implemented using your command-line file->module grouping idea i.e. scan the DEPS file and generate a file list interspersed with |
Beta Was this translation helpful? Give feedback.
-
My previous idea won't work, you can't unilaterally rug-pull namespaces across the entire code base, namespace reassignment has to be done by the client modules themselves. So back to the Deno is interesting, there is no separate package manager, it just leverages TypeScript's |
Beta Was this translation helpful? Give feedback.
-
Yeah, I started to realize that module membership is basically intrinsic to the declaring module, so at the very least the |
Beta Was this translation helpful? Give feedback.
-
Module publication and subscription is a surprisingly knotty problem, but without a way for developers to painlessly contribute and consume libraries and applications a language can't scale horizontally and won't gain traction. Virgil is such a nice language and (by pure serendipity?) a perfect fit for Wasm+WASI. It would be a shame not to take advantage of this window of opportunity. |
Beta Was this translation helpful? Give feedback.
-
Thanks! I generally agree with you wrote. I am pulled in many directions and so far have focused on solving my own problems as they pop up. Wasm+WASI is within reach. I chip away at that when I get a chance but can use some help. Modules would be a great addition to the language so I am really glad to discuss on this thread how this might come about. |
Beta Was this translation helpful? Give feedback.
-
Great to hear.
I really do empathise. The amount and quality of the work you've done is phenomenal but there's only so much one person can do. If I knew how to make a software project go viral based on merit alone I'd be famous. It's frustrating, but the the old adage "make a better mouse trap and they will come" doesn't apply to software. |
Beta Was this translation helpful? Give feedback.
-
lol, no worries. It's alright being kinda low-profile but not totally dead. Virgil's been a slow burn for a sizeable chunk of my life now and really my bandwidth for explaining it all lags my imagination to create more stuff, so I write few papers and instead chisel on a thing optimized for my chiseling. |
Beta Was this translation helpful? Give feedback.
-
Yeah, just stick to what you enjoy. Maybe the whole module pub/sub issue, along with the need for standard libraries, could be sidestepped with Wasm+WASI+Component Model module imports? Module management being farmed out to an external language-agnostic Wasm package manager such as wapm. It's still early days regards WASI and the Wasm Component Model but once the dust settles Wasm may well deliver on Java's promises of portability and security. I don't know if the seamless integration of Wasm+WASI modules is feasible, but from the looks of the Wizard Engine project you have mastered Wasm and have a head start in that direction. |
Beta Was this translation helpful? Give feedback.
-
Yeah, that's a good idea. It might help both WASI and Virgil to have a GC'd language targeting WASI from the get go. I was struggling to reverse-engineer the intended semantics of |
Beta Was this translation helpful? Give feedback.
-
Just my $0.02: I've been learning the MoonBit programming language lately, and their package system seems pretty nice and might provide some ideas for inspiration. Meanwhile, I'm trying to learn Virgil by writing an Extism PDK for it, and I've stumbled across a namespace issue.
It seems like this statement doesn't include oddly-named modules such as I tried Right now I'm leaning toward using |
Beta Was this translation helpful? Give feedback.
-
How can you disambiguate same-named components and classes from different source files (aka the module problem)?
I see that this issue was addressed as as "Future Work" in the 2013 paper https://dl.acm.org/doi/10.1145/2491956.2491962
The current EBNF grammar file contains "import" and "export" keywords but I haven't been able to find a description of their semantics:
virgil/doc/virgil-grammar.ebnf
Line 5 in 3038dea
virgil/doc/virgil-grammar.ebnf
Line 35 in 3038dea
Beta Was this translation helpful? Give feedback.
All reactions