HaxeFoundation / haxe.org-comments

Repository to collect comments of our haxe.org websites
2 stars 2 forks source link

[haxe.org/manual] Access Control #140

Open utterances-bot opened 8 months ago

utterances-bot commented 8 months ago

Access Control - Haxe - The Cross-platform Toolkit

Haxe is an open source toolkit based on a modern, high level, strictly typed programming language.

https://haxe.org/manual/lf-access-control.html

EliteMasterEric commented 8 months ago

A note that this documentation glosses over; there are two different forced access metadatas:

So if you want to access a single variable within the Target in a single line, you probably want to use @:privateAccess just before you perform the actual access. If you want to access multiple variables or you want to perform access multiple times, especially if it's across several methods within a class, you should put @:access at the top of the method or at the top of the module.

EDIT: Also, if you're having trouble, try using the fully qualified name inside the metadata instead of just the class name (so include the package, and the module name if that is different).