REWORK - Task: Unify behaviour of by-literal-instantiated Objects

Discussion in 'Ruby' started by Ilias Lazaridis, Jun 21, 2011.

  1. (Note: This task is part of the RUBY REWORK, which has (among other
    goals) the goal to remove inconsistencies and limitations in the
    Object Model and in the language. The time frame for the overall
    rework is 3 months.)


    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-
    # this alteration is valid program wide
    class String
    @@running_counter = 0

    def initialize(val)
    @@running_counter += 1

    def running_counter

    #now the strings contain a running_counter, convenient accessible via
    an instance method

    oo_string ="The String 1")
    p oo_string.running_counter #=> 1

    oo_string ="The String 2")
    p oo_string.running_counter #=> 2


    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).


    * 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):

    * 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
    * 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

    Provide Class#cb_object_instantiated_from_literal(object)

    Unify Variable Expansion within Strings

    Ilias Lazaridis, Jun 21, 2011
    1. Advertisements

  2. 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.

    Ilias Lazaridis, Jun 21, 2011
    1. Advertisements

  3. This is now obsolete, no assistance needed.
    Would still like to have someone to place some questions, thus some
    time is saved.
    Ilias Lazaridis, Jun 22, 2011
  4. obsolete, no assistance needed
    obsolete, no assistance needed, relevant information found within:
    obsolete, no assistance needed

    (implementation will be very "thin" and need anyway a review/revision
    from the C-OO-model maintainer)

    Still, it would be nice if someone could review/test a result prior to

    So, if you like to do so, please contact me in private.

    Ilias Lazaridis, Jun 23, 2011
  5. met (task fulfilled with 0,- Euro)
    not needed finally
    exactly 0 (zero) persons have contacted me.
    You'll find further information in the above issue.
    Ilias Lazaridis, Jun 25, 2011
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.