octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Classdef embryonic support


From: Michael Goffioul
Subject: Re: Classdef embryonic support
Date: Sun, 13 Jan 2013 20:08:27 -0500

On Sun, Jan 13, 2013 at 5:34 PM, Ben Abbott <address@hidden> wrote:

On Jan 13, 2013, at 3:47 PM, Michael Goffioul wrote:

> On Sat, Jan 12, 2013 at 7:02 PM, Ben Abbott <address@hidden> wrote:
> On Jan 12, 2013, at 11:54 AM, Michael Goffioul wrote:
>
> > On Sat, Jan 12, 2013 at 11:34 AM, Ben Abbott <address@hidden> wrote:
> > On Jan 6, 2013, at 10:35 PM, Michael Goffioul wrote:
> >
> > > On Tue, Jan 1, 2013 at 8:09 PM, Michael Goffioul <address@hidden> wrote:
> > > Hi,
> > >
> > > Just a heads up to let people know I've spent some time during my christmas holiday to start working again on the classdef branch. I've just pushed some changes to implement initial support for handle-class and value-class semantic. Don't expect too much out of it, but maybe some of you are interested in giving it a try. For instance, I'd be more than happy if someone would write unit tests for the classdef support.
> > >
> > > Did anybody have a chance to give it a try? Although far from finished, it's already somehow usable (you can define classes, methods, properties, use inheritance and make superclass calls; it also supports handle and value semantics).
> > >
> > > Michael.
> >
> > The classef branch now builds on MacOS X! :-)
> >
> > I'm new to classdef, so I borrowed an example from the Mathworks site, made some modifications, and added some tests (see the attached payment.m)
> >
> > However, I'm not sure how to go about adding tests to the sources.  Perhaps syntax like below be added to the test feature?
> >
> > %!classdef payment
> > %!   properties
> > %!     rate;
> > %!     term;
> > %!     principle;
> > %!   end
> > %!   methods
> > %!     function obj = payment (r, t, p)
> > %!       obj.rate = r;
> > %!       obj.term = t;
> > %!       obj.principle = p;
> > %!     end
> > %!     function amt = amount (obj)
> > %!       i = obj.rate / (12 * 100);
> > %!       amt = (obj.principle * i) / (1 - (1 + i)^(-obj.term));
> > %!     end
> > %!   end
> > %!endclassdef
> >
> > For now, tests can be added to a classdef m-file, but I don't see how that would be committed.
> >
> > See how tests are designed for the old-style class in test/classes/.
>
> That's simple enough.  I've attached a changeset with some basic tests.  Look ok?
>
> > Thanks for giving it a try, Ben. I'm fully aware of the limitations and all these are on my (huge) TODO list. At the moment, what is supported is:
> > - classdef file parsing
> > - handle/value class semantic
> > - class inheritance
> > - property/method access with dot-notation
> > - property/method access restriction (public, protected, private, cell array of classes)
> > - property accessors
> > - array of objects(not complete, though)
> >
> > Michael.
>
> I'll start tinkering more with classdef.   As I come up to speed, I'll add more tests.
>
> Thanks, Ben.
>
> Maybe classed tests should be put into their own subdir, to avoid confusion. Also it might be clearer if the class names were chosen to reflect what is actually tested, or whether it's a base/abstract/derived/... class (e.g.: BaseHandleClass, DerivedValueClass, BaseSealed, privateProp, sealedMethod...) and similarly for property/method names.
>
> Michael.

Ok. Do you have any test scripts you're currently using for development purposes that I might be able to modify? (my OOP experience is limited)


At the moment, I'm using the attached classes for basic functionalities. There's also a couple of classes I posted for testing earlier this month [1]. But basically, I'd be glad if some people could do the QA for me. Also it may be good to have someone else than me writing some tests based on how the system should behave; I would be biased and write the tests knowing what's implemented and working :)

Michael.

[1] https://mailman.cae.wisc.edu/pipermail/octave-maintainers/2013-January/031550.html

Attachment: ClassH.m
Description: Binary data

Attachment: ClassHD.m
Description: Binary data

Attachment: ClassV.m
Description: Binary data

Attachment: ClassVD.m
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]