Thomas E Enebo created JRUBY-6453:
-------------------------------------

             Summary: Make String/ByteList creation facilities part of 
RedBridge APIs
                 Key: JRUBY-6453
                 URL: https://jira.codehaus.org/browse/JRUBY-6453
             Project: JRuby
          Issue Type: Improvement
            Reporter: Thomas E Enebo
            Assignee: Thomas E Enebo


In looking at a few native extensions it is clear that we need better 
facilities for working with Strings and ByteLists (same can maybe be said for 
IO, but that is a much bigger problem and should be it's own issue). 

So far I am not suggesting specific APIs (example below is just illustrative) 
but we should examine a few common Java native extensions (nokogiri, json, ???) 
and see how we need to manipulate bytelists and rubystrings and provide 
something less exposing of internals and brittle. 

The one other requirement is that we can make something which works for both 
1.8 and 1.9 (and 2.0). If we create two methods where only one requires an 
encoding we should make it obvious what the difference is: 

{noformat}
container.createASCIIString(byte[]);
container.createString(byte[], encoding);
{noformat}

If we had these two forms both just be createString then new developers would 
probably just use the one without encoding. By providing ASCII in the name it 
is obvious what decision they are making by calling it.

 One last thing. It is clear that we will need to expose access several types 
of things: Encoding, ByteList, Fixnum? We can cope with this in two ways:

1. Use Ruby . Ruby exposes way too many things we don't want to encourage.
2. Add something to ScriptingContainer for getting/creating (probably some 
contained class: container.getTypeHelper). This has downside of slowly growing 
to be a huge mess like Ruby I do favor #2 because it will make it very obvious 
what we intend on supporting. We can also slowly grow it based on user-feedback 
(hell they can also work-around lack of missing endorsed way by using #1 until 
there is something).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to