Class method access control lists

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Class method access control lists

Richard Crozier
Matlab supports restricting classdef classes method access to a list of
other classes, see:

https://uk.mathworks.com/help/matlab/matlab_oop/selective-access-to-class-methods.html

In a (fairly old, 4.1.0+) dev version I am using this does not appear to
be present in Octave. I attach and example/test case. Should I submit a
bug report?

In the example, running test_octave_method_access_control.m should
display 'Access granted' on the command line (and does so in Matlab
R2016b). In Octave it results in the error:

error: invalid property/method access in class `testMethodAccess1'

Regards,

Richard

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


testMethodAccess1.m (221 bytes) Download Attachment
testMethodAccess2.m (497 bytes) Download Attachment
test_octave_method_access_control.m (76 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Class method access control lists

Mike Miller-4
On Tue, Apr 03, 2018 at 12:32:10 +0100, Richard Crozier wrote:

> Matlab supports restricting classdef classes method access to a list of
> other classes, see:
>
> https://uk.mathworks.com/help/matlab/matlab_oop/selective-access-to-class-methods.html
>
> In a (fairly old, 4.1.0+) dev version I am using this does not appear to be
> present in Octave. I attach and example/test case. Should I submit a bug
> report?
>
> In the example, running test_octave_method_access_control.m should display
> 'Access granted' on the command line (and does so in Matlab R2016b). In
> Octave it results in the error:
>
> error: invalid property/method access in class `testMethodAccess1'
If you change the syntax from

    methods (Access = ?testMethodAccess2)

to

    methods (Access = {?testMethodAccess2})

then it works in Octave.

I think you should file a bug report for the missing Matlab
compatibility.

--
mike

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Class method access control lists

Richard Crozier


On 08/04/18 08:15, Mike Miller wrote:

> On Tue, Apr 03, 2018 at 12:32:10 +0100, Richard Crozier wrote:
>> Matlab supports restricting classdef classes method access to a list of
>> other classes, see:
>>
>> https://uk.mathworks.com/help/matlab/matlab_oop/selective-access-to-class-methods.html
>>
>> In a (fairly old, 4.1.0+) dev version I am using this does not appear to be
>> present in Octave. I attach and example/test case. Should I submit a bug
>> report?
>>
>> In the example, running test_octave_method_access_control.m should display
>> 'Access granted' on the command line (and does so in Matlab R2016b). In
>> Octave it results in the error:
>>
>> error: invalid property/method access in class `testMethodAccess1'
>
> If you change the syntax from
>
>      methods (Access = ?testMethodAccess2)
>
> to
>
>      methods (Access = {?testMethodAccess2})
>
> then it works in Octave.
>
> I think you should file a bug report for the missing Matlab
> compatibility.
>

Thanks for explaining this, I'll file a bug for the minor incompatibility.

Richard

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.