JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Tue Oct 31, 2006 10:54 pm Post subject: October 31st -- IO lib and sundry other things |
|
|
I've started an IO library which will encompass things found in D's std.file, std.path, and (some of) std.stream. It's not done yet, but it's fairly useable. Using this new library, I ported the wordcount demo from the D spec over to MiniD -- and it works! It's not incredibly fast, but that's still the debug version..
Some other things:
- Fixed a bug in the compiler where an empty file would cause it to give an "invalid encoding" error.
- Changed some type deduction stuff for MDState.push, .setGlobal, and .setUpvalue. This fixes some annoying stuff regarding D's implicit conversion between int and dchar.
- Changed the MDState.printStack method to "final", which fixes a bug regarding compiling MiniD into a library under one mode (release or debug) and linking against it using another.
- Added an overload of MDState.getInstanceParam to allow MiniD to check that the instance that you're getting is of the correct class type.
- Added MDState.getParams, which allows you to get a slice of the params passed to the native function.
- Fixed some bugs in MDState regarding overflows. Stupid off-by-one errors.
- Changed metamethod lookup slightly for tables. Now you can declare methods in tables and call them with the obj:method() syntax; the methods are looked up first in the table itself, and then in the global table type metatable.
- Changed metamethods for binary operators slightly -- now if there is no metamethod for the first operand, the operation will fail, rather than trying to get the method from the second operand. This is because some operators (like subtract) make no sense when you try to switch the order of the parameters. This is why D has things like opSub_r. Not sure if I'll bother adding support for _r style metamethods -- operator overloading isn't really supposed to be MiniD's strength
After having implemented the File class for the IO lib, I'm starting to get an idea of what I'll have to do to create the Pyd-like function and class wrapping. That's really the main part of the project that's coming up.
Before I do that, though, I'd really like to make some kind of "initial release" of MiniD, once I get all the stdlibs done. That can be a sort of test run, to get it out there, and get people using it and finding bugs and stuff. Then work on the scary template stuff can begin. |
|