Comments (10)
It seems that everyone is happy with public
. I will use it when I eventually get around to implementing this :)
from jou.
How about a decorator?
@public
def add(x: int, y: int) -> int:
return x + y
from jou.
I think on the contrary, you can use the "extern" keyword to decide which functions need to be exported.
Then other variables, functions, structs of the current file will not be accessed.And then, they will be private
from jou.
def internal_util_function() -> int:
return 123
static struct PrivateStruct:
x: int
y: int
extern def public_function() -> int:
return internal_util_function() * 2
extern struct PublicStruct:
message: byte*
line: int
from jou.
I think on the contrary, you can use the "extern" keyword to decide which functions need to be exported. Then other variables, functions, structs of the current file will not be accessed.And then, they will be private
So basically, everything is private by default, and you can use a keyword like extern
to make public things. This seems like a good idea.
I think I will probably name the keyword public
instead of extern
, for two reasons:
- With
extern
many people would think: "what does theextern
keyword do again? Ah now I remember, it makes the thing public." - The
extern
keyword has a different meaning in C. Jou'sdeclare
and C'sextern
both correspond to the same idea: they tell the linker that something exists without defining it.
from jou.
More possible keywords to use for this:
export
, same as in JavaScriptpub
, same as in Rust
from jou.
- I think I don't like
export
, because it would get confused with__declspec(DLLEXPORT)
in windows. pub
is a bit too short considering Jou's goals: we need readability.
from jou.
I think global
or public
will be the most clear
from jou.
public
looks fine to me. I understood extern
just fine and would be a little disappointed if someone couldn't deduce its meaning.
from jou.
I like that, but if it isn't written in Jou that would feel a bit too automagic-y for a decorator.
from jou.
Related Issues (20)
- `as` precedence HOT 1
- compiler segfault when struct contains array of pointers to itself
- bool == bool HOT 2
- byte < byte
- sometimes error message for using . in class is misleading HOT 3
- `assert True` --> weird warning HOT 2
- compiler doesn't seem to understand what `not` does to booleans
- Methods that take self by value
- Error: the '&' operator cannot be used with a field of self
- Dunder methods? HOT 5
- Compile time struct HOT 6
- tutorial: Explain when to use pointer HOT 1
- Platform if statements inside class
- doctest netbsd base64 error HOT 2
- Release description
- no expf() function HOT 4
- Replace the full path to 'Jou'? HOT 5
- Sharing compiled binaries HOT 1
- compiler internals: AST_STMT_FUNCTION is weird
- Rename long to int64? 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 jou.