EEC-Developers / eec

Enhanced E Compiler - AmigaE programming
Other
12 stars 3 forks source link

Private methods of a an exported object are publicly exported #18

Open SamuraiCrow opened 3 years ago

SamuraiCrow commented 3 years ago
EXPORT OBJECT arf PRIVATE
  bla
ENDOBJECT

EXPORT PROC dog() OF arf IS WriteF('I should be exported.')

PROC cat() OF arf IS WriteF('I should not be exported.')

Using viewmodule reveals that the cat() method is also exported.

As a workaround, make cat a local function and pass in self as a PTR TO arf so it is not a method of arf directly.


PROC cat(self:PTR TO arf) IS WriteF('I am not exported now.')
SamuraiCrow commented 3 years ago

Note that: self.cat() becomes cat(self) when using the workaround.