Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Value classes - do you use them? also syntax questions
Replies: 4   Last Post: May 22, 2013 4:32 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
EBS

Posts: 77
Registered: 2/11/09
Value classes - do you use them? also syntax questions
Posted: May 21, 2013 4:22 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I posted the below on Answers but got no responses, perhaps the newsgroup is a better forum to discuss this :)
---------

So I can't really recall ever creating a value class, all mine seem to be handle classes. Is that the same as your experience? Unless I'm completely missing something, using value classes seems to be a bit ungainly, because you always have to do two steps like this:

foo = MyValueClass(5); % sets a property 'val'
foo = foo.double();
plot(foo.val);

With a handle class, I'd just do this:

foo = MyHandleClass(5);
plot(foo.double()); % double returns the new obj.val directly.

Am I completely out to lunch with this understanding of value classes?

As an aside, sometimes it seems like it would be nice to have the above syntax of a handle class, but be able to make independent copies of a given object like a value class... Anyone else think so?

Thanks for your thoughts, Eric



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.