octave-maintainers
[Top][All Lists]
Advanced

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

Re: classdef is pretty good now (inputParser implemented in core). What


From: Philipp Kutin
Subject: Re: classdef is pretty good now (inputParser implemented in core). What now? How to document classdef classes?
Date: Sun, 31 Aug 2014 15:28:17 +0200

Hi,

On Thu, Aug 21, 2014 at 4:23 PM, Carnë Draug <address@hidden> wrote:
> Kudos to Michael Goffioul for working on it.

Thanks indeed to Michael and jwe for making classdef happen. Handle
classes being the only way I know of to create objects that can be
manipulated by reference, it adds the capability to write application
code in a cleanly structured manner known from OO programming.

I have been writing classdef code for a while and have come across the
following differences or missing features relative to MATLAB. I'm
listing them along with workarounds that I have adopted.

* No support for secondary functions.  (I see it's bug #41723.)
Secondary functions are a nice feature to prevent cluttering the
project directory with many small files. As a workaroud, one can use
static methods, but that's slightly imperfect as class names tend to
be LongAndUnwieldy.

* "properties (Constant)" is not implemented.  This would probably
require field initializers to be implemented first. It can be worked
around by using static zero-argument methods instead, since one can
call non-handle functions without parens.

* isa(obj, 'ClassName') checks for exact equality, i.e. for obj being
an instance of class ClassName. MATLAB's isa() also checks for obj
being derived from ClassName, i.e. is equivalent to metaclass(obj) <=
?ClassName

* "methods (Abstract)" is not implemented.  It would require some
tweaking of the parser, I presume. A workaround is to simply have
pseudo-abstract methods in the base class that unconditionally error.

* [objs{:}] when objs is a cell array of same-class objects doesn't
work. I wanted this mainly for writing concise code of looping over
all objects in a cell (I don't keep them in arrays as I find that
concept weird). No big deal.

* I haven't checked, but since my patch wasn't committed I assume that
"calling" a classdef objects still results in an Octave crash. See
patch #8152.

* Classdef files won't be re-read on change. This is very complex of
course. As long as you can just quit a session, start Octave anew, and
restore it, it's not much of an issue.

All in all classdef is pretty usable and I see that in HG, the spammy
debugging messages are now gone, too. Nice!

Cheers,
Philipp



reply via email to

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