the.bay.news

To Hide, or Not To Hide

Ziggit
To Hide, or Not To Hide
“Sequel” of this post In my current project I use following technique for hiding of implementation details: 1 - Implementation is private const _Mailbox = struct { mutex: Io.Mutex, ..................... }; 2 - Access to _Mailbox functionality is done via pub const MailboxHandle = *anyopaque; // Actually *_Mailbox 3 - Ctor pub fn new(io: Io, alloc: std.mem.Allocator) !MailboxHandle { // Always allocated ........................ } 4 - “Methods” pub fn close(mbh: M...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.