You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When writing code, one common thing a programmer might wish to do is reference another function by a shorter name without making it a part of the public interface for their library/program. Odin disallows all attributes for constant alias declarations, I understand this decision makes sense for things like @static or @link_prefix. However, @private only refers to the name access aspect, and thus can be safely applied to an alias without "corrupting" the attributes of the aliased thing.
There's also 2 more design considerations to take:
The current system is inconsistent. here's an example:
import"base:intrinsics"import"core:testing"@private
cas :: intrinsics.atomic_compare_exchange_strong // This is allowed (good)@private
expect :: testing.expect // Not allowed.
The current system can also be trivially circumvented for procedures either way but it's very ugly:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When writing code, one common thing a programmer might wish to do is reference another function by a shorter name without making it a part of the public interface for their library/program. Odin disallows all attributes for constant alias declarations, I understand this decision makes sense for things like
@static
or@link_prefix
. However,@private
only refers to the name access aspect, and thus can be safely applied to an alias without "corrupting" the attributes of the aliased thing.There's also 2 more design considerations to take:
The current system is inconsistent. here's an example:
The current system can also be trivially circumvented for procedures either way but it's very ugly:
Beta Was this translation helpful? Give feedback.
All reactions