Comments (6)
Hey,
It would be definitely possible. The tricky parts would be C-interoperability and basically all the parts which use some form of assembly.
Anyway, are slow compilation times really a problem with Crystal? Recompiling Charly takes about 1.3 seconds for me (unoptimized build), which is extremely fast in my opinion.
I don't really see a need for an interpreted version of Crystal, but if there is a strong desire from the community for such a project to be developed, I'd love to help out wherever I can!
Are there other people who want this, maybe even from the core-team?
from charly.
Hello!
I'm basically in full agreement with what RX14 has said. I really don't know enough about the internals of the Crystal compiler to know what is and isn't possible (e.g., with templating, open types, etc.), but the idea of using the same front-end and just swapping the codegen for an interpreter sounds like the right direction.
I have a lot of questions I'd have to work through to really get an idea of what's possible here, but I'd definitely be willing to help out/continue discussions/etc.
from charly.
Also we don't have to rewrite all, we can reuse the current lexer, parser and std-lib, just replacing the code-gen by a custom VM (I have no idea how to do it
from charly.
It would be definitely possible.
Oh, great!
The tricky parts would be C-interoperability and basically all the parts which use some form of assembly.
Maybe we can add some warning for this, saying something like: if you want to use this feature you should use crystal build
instead or maybe using JIT compiling or similar for this. (I guess Julia lang does something similar)
@KCreate I had the idea because I was asking for a true REPL for crystal, and I got a very interesting response from @RX14 :
the problem was never being compiled
nobody ever said that
the problem has and has always been the type system
Then he wrote some nice comments:
Since you can reuse the existing compiler
What you'd do is pass the whole program through most of the existing crystal compiler
And instead of Codegen use the existing AST in a vm
It'd be slow as shit but who cares
Every time you make an update youd reconstruct the AST for the whole program again
Making an interpreter with no checking (its already been done by the compiler) is far easier than making one from scratch
So, the problem is not because crystal slow compilation (sometimes is very slow, though), but because the type system.
my observation is that the compiler isn't actually that slow
and the compiler being slow isn't the problem
you just run "half" the compiler
even for a moderately sized application
you should be able to do hot reload with this
icr is uselss to me
what I want is the ability to use it as an in-program debugger
and possibly for hot-reload
Ref: https://gitter.im/crystal-lang/crystal?at=5ab00ef5f3f6d24c689220d7
from charly.
Also, There is Myst a nice dynamic, interpreted, functional language made with crystal by @faultyserver
Maybe he can share his opinions about a VM for crystal as well
from charly.
Interesting post here: https://www.reddit.com/r/crystal_programming/comments/91r8im/crystal_has_a_compilation_issue/
from charly.
Related Issues (20)
- Refactor Parser & Lexer configuration
- Dump dot-language AST graph
- Refactor CLI Interface HOT 4
- Anonymous methods are saved to the local scope
- Improve Object.keys()
- Wrong formatting on index out of bounds exception.
- Remove references from the language
- Share trace entries across included files.
- Fix invalid method name checks
- Escape sequence for backslash in Strings
- Remove Object.instanceof
- Make Object.typeof an operator
- Refactor the way the prelude is loaded. HOT 1
- Remove operator overloading from the language HOT 1
- Change repo topic from "crystal-lang" to "crystal" HOT 1
- Binary, Octal, Hex literals
- Bitwise operators HOT 4
- AND assignment for bitwise operators HOT 2
- Charly lang embeded inside Crystal HOT 4
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 charly.