Comments (10)
Many people think it's unnecessary. I feel like we should copy Go's behavior and allow internal modules. Easy to do by just comparing the name to internal
.
from v.
Actually, the only thing public by default in a V module is the module name. All structs, fields in structs, receiver methods, constants, functions, etc. must be marked with the pub
keyword to make them public (with none of the Go nonsense of the capitalization of the first letter of a name controlling public vs private).
from v.
Actually, the only thing public by default in a V module is the module name. All structs, fields in structs, receiver methods, constants, functions, etc. must be marked with the
pub
keyword to make them public (with none of the Go nonsense of the capitalization of the first letter of a name controlling public vs private).
That's what I meant by modules being public by default. That means that they can be imported from anywhere. This proposal is to restrict that.
Thanks for your input!
PS: I also prefer the pub keyword over the capitalization used in Go, but that doesn't stop me from coding in Go.
from v.
I code in Go all day at work.
I don't understand the problem of a module name being public. You can import it all day, but if nothing in it is marked public, you can't do anything with it... you just have a "dead" import.
from v.
I code in Go all day at work.
I don't understand the problem of a module name being public. You can import it all day, but if nothing in it is marked public, you can't do anything with it... you just have a "dead" import.
If you work in Go all day, then you know why internal modules exist, right? It is basically the same concept as Go's internal modules.
from v.
Yes, I know they exist, and they do it by directory structure, not keywords.
An import of a path containing the element “internal” is disallowed if the importing code is outside the tree rooted at the parent of the “internal” directory.
Never used them - never saw the need. However, I understand that some might like "hiding" modules. I was mainly responding to your quote that everything in V modules is public, which it isn't. Only the module names are public by default, not the contents.
from v.
Yes, I know they exist, and they do it by directory structure, not keywords.
An import of a path containing the element “internal” is disallowed if the importing code is outside the tree rooted at the parent of the “internal” directory.
Never used them - never saw the need. However, I understand that some might like "hiding" modules. I was mainly responding to your quote that everything in V modules is public, which it isn't. Only the module names are public by default, not the contents.
OK, reading again, I agree that the wording makes it seem that it is all public by default, but what is meant is that the module itself is public, not its contents. If you make something public (struct, function, etc..), then all modules can import it. There is no way of limiting this to only the parent module and sibling modules.
I will change the wording to reflect this.
Thanks once again!
from v.
As for the keyword, it was mainly because when I asked if it was supported in V, someone mentioned it. I don't really care if it uses a directory "internal" or if it uses a keyword. I have only suggested the two ways for discussion.
from v.
Many people think it's unnecessary. I feel like we should copy Go's behavior and allow internal modules. Easy to do by just comparing the name to
internal
.
Hi, Alex!
I think that'll do. Thanks for your input!
from v.
Better turn this into a GitHub discussion
from v.
Related Issues (20)
- WASM backend indexing issue
- passing a function to a function as a parameter does not work HOT 5
- cannot return a function from a generic function HOT 3
- docs: MD rendering issue on modules.vlang.io
- Optional explicit interface implementations HOT 4
- Allow to omit commas in multiline function signature block HOT 4
- https://vlang.io/ REPL example doesn't work
- Provide easier installer like Rust HOT 5
- fmt: a regression was introduced in #22025 (vfmt struct init) HOT 3
- Precision format ignored in string interpolation HOT 4
- sum types should have a default 0 value for the first type mentioned in the list of types. HOT 4
- Passing a map to a generic argument changes a key value from int to an empty string HOT 1
- Module resolution depends on working directory HOT 3
- Free an optional structure HOT 7
- C error when comparing array to nil
- Compiler error when trying to convey a variadic argument set HOT 3
- Invalid conversion from camel to snake string with numbers HOT 4
- C error when returning a fixed-size array (NOTE: initialization with a for loop doesn't help) HOT 2
- C error when initializing fixed-size array HOT 2
- Returning fixed size arrays is still making C errors, even with the size being a normal int HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from v.