jamoma / JamomaCore

Jamoma Frameworks for Audio and Control Structure
Other
36 stars 14 forks source link

Ambiguous conversion for functional-style cast from 'const value_type' (aka 'const TTElement') to 'TTDictionary' #319

Closed theod closed 8 years ago

theod commented 9 years ago

The following code doesn't compile :

TTDictionary state; object.get("state", state);

would it be possible to allow this @tap ?

theod commented 9 years ago

notice also that the following code return the same error :

 v;
TTDictionary state;
 object.get("state", v);
 state = v;

but if I do :

  state = v[0]; 

it's fine ...

tap commented 9 years ago

It looks like TTValue doesn't have any direct support for dictionaries. This should be easy to do.

tap commented 9 years ago

I now realize that this is less straightforward. I think it was a mistake to store dictionaries in TTValue by name. We have a much better model for representing references now. I'm not sure where we are doing some of this dictionary-by-name access so I'll do this work on a branch and then give it to @theod for review.

theod commented 9 years ago

"I'm not sure where we are doing some of this dictionary-by-name access" : I'll maybe use the name dictionary for State management … but it is not sure for the moment.

tap commented 9 years ago

Actually, I'm seeing this is a rabbit trail with a lot of work involved... I'm checking in this work on a branch, then maybe we can patch this particular issue on dev.

theod commented 9 years ago

or maybe we can patch this on feature/state branch first as it is where we can use this new behavior for real ?

tap commented 9 years ago

@theod We should probably talk about what we want to do with TTDictionary and proceed as you suggest. I need to focus on the audio graph today, however...

Here is the commit of the above. https://github.com/jamoma/JamomaCore/commit/abd11ace32775389d242e985ce89516b6c09b866

One thing you might notice is that we previously were leaking dictionaries if they were stored in a TTValue.

I also accidentally checked-in TTAudioGraphSource.cpp

theod commented 9 years ago

no problemo @tap ! it is just to make the code as clearer as possible but this is not problematic to move forward on the state feature.

tap commented 9 years ago

My current thinking is that we should handle this by using std::shared_ptr in TTValue. While this would add to the size of TTElement, it would solve many many problems.

tap commented 8 years ago

Can we close this one @theod ?

theod commented 8 years ago

ok !