Value::getValue() should be renamed


#1

Thanks for the ValueTree and Value classes - they are great!!

But i think if you read the sourcecode it should be clear if you a working with a reference to var-Object or with the var-object itself.
So it think Value::getValue() should be renamed in Value::getVar()

example:

void myWindow::valueChanged( Value& value )
{
  
  if (value.refersToSameSourceAs(Global::getInstance()->currentProjectFileName.getValue()))  // wrong, but will compile!
  ();

  if (value.refersToSameSourceAs(Global::getInstance()->currentProjectFileName))  // right
  ();

#2

I see your point, but in fact you only hit that ambiguity because I forgot to make the Value (const var&) constructor explicit. It certainly should be explicit, and I’ll change that right away!

I did consider calling it getVar() but that just didn’t sound right… You call the function in order to obtain the value, so getValue() feels more correct to me, despite the class itself also being called ‘value’.


#3

Figured i’d post in here rather than start a new thread…
The documentation for Value seems to be a little misleading - had me scratching my head for a bit. Basically, the main description for the Value class doesn’t mention anything about ValueSource, and even talks about subclassing Value (instead of ValueSource). Might help avoid confusion if it were changed to be more accurate.


#4

Ok, thanks - I’ll take another look at those comments and try to improve it.