INTRODUCTION
In ruby, the primitive data types are objects (instances of their
related classes, like Integer or String)
Ruby's object model allows modifications of a class at runtime, even
if it is the class of a primitive data-type.
This is official functionality of the object model, which is
attractive, and provides flexibility - e.g. for framework design.
As a very simple example, a "running_counter" for the String class.
# altering the behaviour of the *original* String class, without sub-
classing
# this alteration is valid program wide
class String
@@running_counter = 0
def initialize(val)
@@running_counter += 1
self.replace(val)
end
def running_counter
@@running_counter
end
end
#now the strings contain a running_counter, convenient accessible via
an instance method
oo_string = String.new("The String 1")
p oo_string.running_counter #=> 1
oo_string = String.new("The String 2")
p oo_string.running_counter #=> 2
LIMITATION
The current implementation of ruby 1.9.2 has the following limitation:
String objects instantiated from literals behave different.
li_string = "The String 3"
p li_string.running_counter #=> 2, was not incremented
li_string = "The String 4"
p li_string.running_counter #=> 2, was not incremented
Although they should have the same behaviour, as they are instances of
class String, they have a slight different behavior.
-
The task is, to modify the ruby interpreter, thus objects instantiated
from literals behave like normally created objects, thus the above
code works as expected (the redefined initialize method is called).
Internally:
* the C-core calls the redefined "initialize" method of an object, if
it's available
Implementation Requirements:
* Minimal influence on execution speed (< 1% if feature is unused,
interpreter dependent if feature is used )
* Reusable functionality (future unification of object model, e.g. to
make speed-critical items first-class-objects)
Needed Resources:
* time : 1 week of time
* budget: 500,- Euro
Needed Assistance (via emails):
ideally:
* Around 1 hour from a person with toolchain experiences (VC++ express
or mingw)
* Around 1 hour from a person which is familiar with the ruby C source
codes
* Around 1 hour from a person which is familiar with the ruby cross-
platform testing
Work Plan:
* 1 day : setup of tool-chain (compiler, debugger, IDE)
* 1 day : looking around in source code
* 1 day : implementation of 1st solution
* 1 day : implementation of 2nd solution
* 1 day : choose solution, refactoring, tests and documentation
* 1 day : spare day
-
If you would like to see this task fulfilled, and want to provide the
mentioned assistance or part of the budget (or a means to collect the
budget within a public system), please contact me with private email.
-
-
-
Related Issues:
Literal Instantiation breaks Object Model
http://redmine.ruby-lang.org/issues/4893
Provide Class#cb_object_instantiated_from_literal(object)
http://redmine.ruby-lang.org/issues/4845
Unify Variable Expansion within Strings
http://redmine.ruby-lang.org/issues/487
.
Clarification (for those which start to send legal nonsense via
private email):
The above refers to a donation-system, which I've seen for several
open-source projects.
It should be obvious that this RUBY REWORK is naturally based on open
sources (BSD/Ruby licensed), and that it's more than a full-time
commitment that (again naturally) needs a budget. The final natural
thing is, to try to raise those budget via a public system (which
keeps track of the donations).
Of course you are free to suggest such a system here in this thread.
.
> The task is, to modify the ruby interpreter, thus objects instantiated
> from literals behave like normally created objects, thus the above
> code works as expected (the redefined initialize method is called).
[...]
> Needed Assistance (via emails):
>
> ideally:
> * Around 1 hour from a person with toolchain experiences (VC++ express
> or mingw)
This is now obsolete, no assistance needed.
> * Around 1 hour from a person which is familiar with the ruby C source
> codes
> * Around 1 hour from a person which is familiar with the ruby cross-
> platform testing
Would still like to have someone to place some questions, thus some
time is saved.
> Work Plan:
>
> * 1 day : setup of tool-chain (compiler, debugger, IDE)
> * 1 day : looking around in source code
> * 1 day : implementation of 1st solution
> * 1 day : implementation of 2nd solution
> * 1 day : choose solution, refactoring, tests and documentation
> * 1 day : spare day
.
> The task is, to modify the ruby interpreter, thus objects instantiated
> from literals behave like normally created objects, thus the above
> code works as expected (the redefined initialize method is called).
[...]
> Needed Assistance (via emails):
>
> ideally:
> * Around 1 hour from a person with toolchain experiences (VC++ express
> or mingw)
obsolete, no assistance needed
> * Around 1 hour from a person which is familiar with the ruby C source
> codes
obsolete, no assistance needed, relevant information found within:
http://www.ruby-doc.org/docs/ProgrammingRuby/html/ext_ruby.html
> * Around 1 hour from a person which is familiar with the ruby cross-
> platform testing
obsolete, no assistance needed
(implementation will be very "thin" and need anyway a review/revision
from the C-OO-model maintainer)
> Work Plan:
>
> * 1 day : setup of tool-chain (compiler, debugger, IDE)
> * 1 day : looking around in source code
> * 1 day : implementation of 1st solution
> * 1 day : implementation of 2nd solution
> * 1 day : choose solution, refactoring, tests and documentation
> * 1 day : spare day
[...]
Still, it would be nice if someone could review/test a result prior to
submission.
So, if you like to do so, please contact me in private.
.
met
> * Reusable functionality (future unification of object model, e.g. to
> make speed-critical items first-class-objects)
met
> Needed Resources:
>
> * time : 1 week of time
met
> * budget: 500,- Euro
met (task fulfilled with 0,- Euro)
> Needed Assistance (via emails):
>
> ideally:
> * Around 1 hour from a person with toolchain experiences (VC++ express
> or mingw)
> * Around 1 hour from a person which is familiar with the ruby C source
> codes
> * Around 1 hour from a person which is familiar with the ruby cross-
> platform testing
not needed finally
> Work Plan:
>
> * 1 day : setup of tool-chain (compiler, debugger, IDE)
> * 1 day : looking around in source code
> * 1 day : implementation of 1st solution
> * 1 day : implementation of 2nd solution
> * 1 day : choose solution, refactoring, tests and documentation
> * 1 day : spare day
>
> -
>
> If you would like to see this task fulfilled, and want to provide the
> mentioned assistance or part of the budget (or a means to collect the
> budget within a public system), please contact me with private email.
exactly 0 (zero) persons have contacted me.
> -
> -
> -
>
> Related Issues:
>
> Literal Instantiation breaks Object Model
> http://redmine.ruby-lang.org/issues/4893
You'll find further information in the above issue.