Trivial (but not bikeshed please) question of style…

via Digitalmars-d digitalmars-d at puremagic.com
Tue Oct 28 12:28:00 PDT 2014


On Tuesday, 28 October 2014 at 17:44:36 UTC, Steven Schveighoffer 
wrote:
> But parent is not the actual object, it's a *mailbox* of that 
> object, or a reference. In essence, you are saying "use this 
> recipient record to send a message to it's target"

I think in general you should strive to achieve this syntax:

"subject.method(object);"

Who are you asking to do the "send"? Not "parent", so parent is 
not subject for "send", it is subject for "receive":

"Subject, do method using object!".

> If you are saying we should expect sort(arr) to return a *copy* 
> of the array that is sorted, I don't think that's a fair 
> assessment of D user expectations.

I prefer to use import systems where I retain the module name for 
non-generic "free" functions. So then then module will be the 
subject of the action, or I add a prefix with underscore to 
indicate an affiliated subject:

os.syscall()  // os is the subject
gc_free()  // gc subsystem is the subject

I very seldom have short free functions that aren't strictly pure.


More information about the Digitalmars-d mailing list