Comments (2)
Maybe the intermediate structure idea isn't going to pass, but as a first effort the following can be done:
- make every class
foreign
, - remove constructors and replace them entirely with static methods,
- remove destructors and let
ref object
finalizer handle everything.
I'm also thinking about changing the syntax of foreign()
to be a lot more clean and readable:
wren.foreign("module"):
Greeter:
# regular procs would work as usual
greet
# * would declare a static proc
*newGreeter -> new
# ? would declare a getter
?greeting
# *? or ?* would declare a static getter
*?world
This would solve issues #4 and #10, which I'm unable to solve with the current DSL.
Why is it more readable? I always find things that are right below each other, with little to no column variation much easier to read. Consider this:
wren.foreign("module"):
Greeter:
greet
[new] newGreeter -> new
[get] greeting
[genStatic, get] world
versus the above example:
wren.foreign("module"):
Greeter:
greet
*newGreeter -> new
?greeting
*?world
As one can see, the sudden jumps between columns in the first example make reading harder. You don't see what's bound, you see how it's bound, and that doesn't aid readability (users should see what they bind first and foremost). It may seem more readable at first, but ultimately some limitations of Nim identifiers cannot be overcome (keywords are a PITA).
from euwren.
Fixed in 0.11.0.
from euwren.
Related Issues (16)
- Enums HOT 1
- Constructor aliasing HOT 1
- Exception handling in foreign procs HOT 2
- Tuples HOT 1
- Documentation generator
- Inline procs HOT 1
- Build fails when using --gc:arc. HOT 5
- Symbol aliasing HOT 1
- Inheritance in type checking
- Explicit static methods HOT 1
- Generate foreign binding code implicitly HOT 1
- Improve type check messages HOT 1
- Foreign types are not supported as return types from foreign procs HOT 1
- Allow for foreign types without constructors HOT 1
- List support HOT 1
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 euwren.