This articles was published on 2012-07-01

[CW 26] mruby news

What happened this week on the mruby front?

NotImplementedError

After an issue with a wrong return value of String#gsub, an NotImplementedError Exception will now be raised in case of an usage of any String method which is requiring RegExp support. Due to the current lack of the Regular Expression support. Following-up this issue I asked Matz how to use this NotImplementedError Exception and he claimed that we should use it for every feature which is relying on a functionality which isn’t inside of the mruby-core. Based on this comment I wrote a patch to do the same for sprintf and printf, due to the reason that both are based on the sprintf functionality.

Commit (sprintf NotImplementedError)

Garbage Collector

At the moment I’m trying to understand the Garbage Collector of mruby in detail. Hopefully I can write a small sum-up a little bit later. In the meantime I wrote a small patch to reduce the size of an union which is used by the Garbage Collector. This will only be taking effect if the Struct feature is disabled in the mruby-core.

Commit

String Interpolation

Matz fixed several issues in the String interpolation of Symbol.

Commit (allow :”text”), Commit (allow :”a=#{15}”)

sizeof

More code cleanup was done by Masaki Muranaka. Several changes were done by changing a fixed length-number to a calculation-operation with sizeof. With this the so called ‘magic-numbers’ were removed and instead it is now easier to read inside of the code what kind of length is actually important to a specific function.

Commit (Use sizeof to get char array sizes)

Memory Leak

A memory leak was found by Masamitsu Murase.

Commit

Module Improvement

Another small patch by Masamitsu Murase had a big impact on the reachability of method names. He only initialized an element of an already existing Struct but it seems that existing code was actually already requiring this pre-init. Now methods from modules which are added by Mixin are reachable in the same way they are in the standard Ruby.

Commit