Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dictionary support in Ruby #3

Open
hems opened this issue Jun 10, 2013 · 0 comments
Open

Dictionary support in Ruby #3

hems opened this issue Jun 10, 2013 · 0 comments

Comments

@hems
Copy link
Member

hems commented Jun 10, 2013

We haven't exposed dictionaries to Ruby and we don't have a jcom.pack! equivalent in Ruby.

Since the dictionaries being passed to move data in the control graph are essentially implemented internally as hashes, it would make sense to somehow bridge them with Ruby's hashes. Maybe something like:

%my_dictionary = {:schema => attribute, :name => ramptime, :value => {:schema => number, :value => 1000}}%

Jesse responds to that suggestion with the following:

This seems a little complicated. Yes, it makes it clear by spelling out the schema types for the dictionary and the value, but accessing it would be something like

my_dictionary.name              <=  I like this one
my_dictionary.value.value           <= Awkward!

which is a little awkward.

I think I would want to access it like

my_dictionary.name
my_dictionary.value

There may also be a need for multiple name/value pairs or multiple values for a certain name (kind of like specifying ramp destination and duration segments to a line object.

my_dictionary.items.each do |item|
    item.name
    item.value
    item.schema
end

my_dictionary = { :schema => attribute, :items => [ :name => ramptime, :schema => number, :value => 1000 ] }

or

my_dictionary.value.each do |value|
    post value
end

my_dictionary = {:dictionary_schema => attribute, :name => ramp, :schema => number, :value => [ 1000, 100, 2500, 300 ] }

I guess it boils down to this. What kinds of data are going to be passed in these dictionaries? and How much meta-data are we trying to pass along with it? e.g. :schema information - for the dictionary and the values.

Just a thought, would it be beneficial to be able to query an object to see what kind of dictionary it is expecting? Or will it suffice to just have a standard configuration - e.g. the convention over configuration ideal.

see more on the original redmine issue http://redmine.jamoma.org/issues/681

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant