FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

May 20 -- Whole bunch of crap

 
Post new topic   Reply to topic     Forum Index -> MiniD
View previous topic :: View next topic  
Author Message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Sun May 20, 2007 1:21 pm    Post subject: May 20 -- Whole bunch of crap Reply with quote

Fun, fun, fun!

Added/Removed
  • Switches can now contain both constant and non-constant case values. Non-constant cases are evaluated in a sort of if-else chain, so put the most common cases at the top of the switch for performance. All non-constant cases are tested before constant cases. There is no way for the compiler or interpreter to tell if there are duplicate non-constant cases, so in that case it'll go to the first case with that value. Non-constant cases are compared using any custom opCmp metamethods (but only if the switched value is of the same type as the case value).
  • New three-way comparison operator, <=>. This is more like an operation than a comparison: it compares the two values in the same way as the other comparison operators, but it returns an integer rather than a bool. The integer is negative for less than, positive for greater than, and 0 for equal. It's basically like calling opCmp on the two values, but this works for non-instance types as well (like ints and such).
  • Added the conditional (?: ) operator. Might as well.
  • Added readDouble and writeDouble to the io.Stream class. readFloat and writeFloat now read and write single-precision floats.
  • Added table.set and table.get, to perform "raw" table sets and gets for tables which have overloaded opIndex and opIndexAssign. These are not available as methods of tables, only through the "table" namespace.
  • Added MDValue.isTrue().
  • Added a bunch of API methods to MDState. These will allow you to manipulate MDValues almost as easily as in MiniD code, and the semantics are the same as well (metamethods are called and such). I'll come up with some sort of documentation soon.


Changed
  • You can now assign arrays directly into MDValues. They will be converted into MDArrays, as long as their elements are of a convertible type. Nested arrays work as well.
  • Arrays can now be compared to each other, for ordering and equality, like in D.
  • Case and default statements can no longer occur in the middle of other blocks of code. They may only appear as the top-level statements immediately inside a switch statement.
  • Changed alignment of MDValue to 1, making it now a 12-byte struct instead of a 16-byte struct.
  • Tables have reacquired some Lua-like opIndex and opIndexAssign behavior. If a table is indexed and the key doesn't exist, it will try to call the table's opIndex. If there's no opIndex, it'll still return null, like it did before. If a key-value pair is assigned into a table which doesn't already exist, any opIndexAssign overload will be called instead of inserting the key-value pair. These behaviors allow for some interesting objects to be created.
  • Concatenation assignment now works on ranges of registers just like concatenation. So "a ~= b ~ c ~ d" will be turned into "a.opCatAssign(b, c, d)". This means the parameters of opCatAssign are now vararg instead of a single value.
  • Concatenation (but not concatenation assignment) will now default to array concatenation if the first element is not an array, string, or char, and has no opCat overload. This way, you can now append elements to the front of arrays, i.e. 1 ~ [2, 3] will give [1, 2, 3]. This has the odd side effect that the concatenation operator is now almost an "array-ize" operator, so you can write 1 ~ 2 ~ 3 and end up with an array, even though there are no arrays in the list of items to concatenate.
  • MDCL will now intelligently choose between an .md file and an .mdm file if no extension is given for the script name. So "mdcl foo" will look for both foo.md and foo.mdm, and choose the newer (most recently modified) one (if either exist).
  • MDValue.typeString() (non-static version) will now give the class name for classes and instances, meaning some error messages will be more useful.
  • The module loading system is in flux. I wouldn't write anything for it right now if I were you.
  • MDState.easyCall() can now accept any type as the "function" parameter. This makes it easy to call any callable MiniD type.


Fixed
  • Realized that the MDArray.create function didn't work right. It was defined twice, and D was choosing the wrong specialization of it. So now the one that creates an MDArray out of a native D array is called MDArray.fromArray, and the one that creates an array from a list of values is still MDArray.create.
  • StringBuffer.append would return prematurely if there was another StringBuffer in the list of items to append. Now appends items after other StringBuffers in the parameter list.
  • Fixed a bug where not enough stack slots would be allocated for native function calls, sometimes causing assertion failures.
  • Fixed a bug in MDState.call where the stack index was not being set correctly in order to get returns.
  • Forgot that modulo by 0 is also an error like division by 0, so that's fixed in the compiler and in the interpreter (though no check for division/modulo by 0 for floats is done in the interpreter.. mostly because the system doesn't usually throw an error for that).
  • There was another bug with namespaces where duplicating a namespace (when you instantiate a class, for example) would not fix up the chained slots, causing namespaces to reference each others' slots instead (!!). Because I'm still not trustworthy of the new namespace code, I've versioned the new namespace code as MDExperimentalNamespaces; leaving that undefined will use a D AA instead, which will be a bit slower to duplicate, but at least I know it works.


Notable changes: dynamic cases in switches, 3-way comparison (<=>) and conditional (?: ) operators, ~= now sucks up any concatenations on the RHS and is now a vararg metamethod, lots of new API functions for basic value manipulations.

The module system is being reorganized in anticipation of dynamic library loading (you can see the MDDynLibLoader class in minid.minid already, though it doesn't do anything yet). It may change even more before I get the dynamic library loading in, so don't write any loaders for it right now.
Back to top
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Sun May 20, 2007 3:35 pm    Post subject: Reply with quote

Just uploaded some fixes to the stack index in the interpreter, some of which were causing errors with concatenation. Finally looked at the Lua source to see where all it was setting the stack index and to what. Should be much better now.
Back to top
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Sun May 20, 2007 7:20 pm    Post subject: Reply with quote

One more update for today.

Changed
    MDCL now defines an exit() function to end an interactive session.


Fixed
  • The compiler will now give proper errors for numbers that are too big to be represented. Why on earth isn't ConvOverflowError derived from ConvError?
  • I never knew the %c formatting character wasn't defined for std.format. Using %c when outputting formatted text no longer throws an error.
  • Exceptions thrown from class ctors can now be caught.
  • Fixed another stack index issue with foreach loops.


Mostly wanted to upload it because of the foreach loop bug. There are also some tests in the "tests" folder. I've been trying to get 100% coverage in all the MiniD source files; I've gotten many of the stdlibs to 100% as of now.
Back to top
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Sun May 20, 2007 8:42 pm    Post subject: Reply with quote

Okay, last commit today, I promise. All this does is fix compilation on linux. Also, to compile on linux, either define the version MDNoDynLibs or put libdl.so on the build commandline.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> MiniD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group