View previous topic :: View next topic |
Author |
Message |
csauls
Joined: 27 Mar 2004 Posts: 278
|
Posted: Thu Oct 01, 2009 2:43 pm Post subject: Cracy concept: MiniD module archives? |
|
|
I know JAR files are evil. Dire evil. The kind of evil that makes one's mother in law seem like a cute puppy. That said, how hard would it be to create loadable MiniD archives? Might be a "MiniD 3" thing, but it could be very useful for projects that want to distribute pre-compiled modules. (Like, say, a game? Or a web framework?)
Would be more useful if coupled with an ability to insist on using the pre-compiled modules even if a newer source module is available. _________________ Chris Nicholson-Sauls |
|
Back to top |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Thu Oct 01, 2009 2:52 pm Post subject: |
|
|
You could do it even now. Just set up a custom module loader. :3 You'd have to be able to access ZIP files, either by writing the loader in D or by binding ZipStream or similar to MiniD.
And yes, you can change the module loader so that it always uses the precompiled version. The module loading mechanism is handled entirely by the standard library, and how it behaves by default is just that - a default. You really can do anything you want At a very high level, the module import mechanism is just a function that maps from strings to namespaces. You can do ANYTHING you want in between there. |
|
Back to top |
|
|
csauls
Joined: 27 Mar 2004 Posts: 278
|
Posted: Thu Oct 01, 2009 9:37 pm Post subject: |
|
|
I knew about modules-as-functions, from some of my earlier skulking about with it, doing lots of silly writing, re-writing, and over-writing of metatables just to see how much I can abuse MiniD. (For the record, a frigging lot, which is awesome.) So thanks, can't believe I didn't think about custom loaders, and I'm going to give that a try sometime.
By the way, I think this says plenty about MiniD and why I like it:
Code: |
waenyinepu@thanatos:~/Projects/MiniD/sieve$ time ./mdcl.exe sieve2 1000000000
Seeking primes up to 1000000000
There are 3401 primes in this set (0.00034%).
real 0m0.229s
user 0m0.172s
sys 0m0.040s
|
Sweet. _________________ Chris Nicholson-Sauls |
|
Back to top |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Fri Oct 02, 2009 1:44 am Post subject: |
|
|
Hooray, speed! \o/
I REALLY want to work on improving the GC but I haven't had the motivation to work on it in a while. That's really the last major performance bottleneck. |
|
Back to top |
|
|
|