62
submitted 9 months ago by hairinmybellybutt to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 1 points 9 months ago

I love dart's approach to getter and setter methods... They let you define methods labelled explicitly as "get" or "set" methods that you can call without writing the parentheses. So the call looks like accessing a member variable, but internally it can handle additional functionality like logging or validation or whatever you want. So the syntax would look like the first example in the meme, but with all the benefits of the second example. I wish more languages would incorporate this

this post was submitted on 02 Jul 2023
62 points (90.8% liked)

Programmer Humor

30571 readers
981 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 4 years ago
MODERATORS