www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - I would like to add some function into core.sys.posix.sys.stat

reply "bioinfornatics" <bioinfornatics fedoraproject.org> writes:
 safe pure nothrow
bool userHasRead( mode_t mode )         { return ( mode & S_IRUSR 
) == S_IRUSR; }

 safe pure nothrow
bool userHasWrite( mode_t mode )        { return ( mode & S_IWUSR 
) == S_IWUSR; }

 safe pure nothrow
bool userHasExecution( mode_t mode )    { return ( mode & S_IXUSR 
) == S_IXUSR; }
Dear,

what do you think to add some sugar into this module. i use these 
furction but is maybe better inside core.sys.posix.sys.stat



 safe pure nothrow
bool groupHasRead( mode_t mode )        { return ( mode & S_IRGRP 
) == S_IRGRP; }

 safe pure nothrow
bool groupHasWrite( mode_t mode )       { return ( mode & S_IWGRP 
) == S_IWGRP; }

 safe pure nothrow
bool groupHasExecution( mode_t mode )   { return ( mode & S_IXGRP 
) == S_IXGRP; }


 safe pure nothrow
bool otherHasRead( mode_t mode )        { return ( mode & S_IROTH 
) == S_IROTH; }

 safe pure nothrow
bool otherHasWrite( mode_t mode )       { return ( mode & S_IWOTH 
) == S_IWOTH; }

 safe pure nothrow
bool otherHasExecution( mode_t mode )   { return ( mode & S_IXOTH 
) == S_IXOTH; }
Jun 16 2013
parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Monday, June 17, 2013 01:00:21 bioinfornatics wrote:
 what do you think to add some sugar into this module. i use these
 furction but is maybe better inside core.sys.posix.sys.stat

I don't think that we should be adding any sugar to core.sys. It's specifically for providing bindings to the OS APIs, not for wrapping them. Phobos is where the wrappers go. In this case, the correct place would be std.file. - Jonathan M Davis
Jun 16 2013