caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: oliver@first.in-berlin.de (Oliver Bandel)
To: caml-list@inria.fr
Subject: Re: [Caml-list] Unix.chmod => what codes for what mode?!
Date: Fri, 23 Apr 2004 21:34:01 +0200	[thread overview]
Message-ID: <20040423193401.GA1761@first.in-berlin.de> (raw)
In-Reply-To: <20040423191449.GA9194@swordfish>

Hi,


On Fri, Apr 23, 2004 at 01:14:49PM -0600, Matt Gushee wrote:
> On Fri, Apr 23, 2004 at 07:01:02PM +0100, Richard Jones wrote:
> > On Fri, Apr 23, 2004 at 07:16:34PM +0200, Oliver Bandel wrote:
> > > 
> > > The Unix.chmod function is bad documented.
> 
> I agree. See below.
> 
> > Almost certainly you're not using octal numbers right.  The format
> > for octal numbers in OCaml is different from C, for example:
> 
> My guess would be that he simply wasn't conscious of the fact that they
> *were* octal numbers--which is the same mistake I made at first and have
> seen several others make. The fact that permissions are octal is easy to
> understand, but--if you have worked with file permissions in the Unix 
> shell and never either worked with them in a medium level language like
> C or thought deeply about what the numbers represent, it's not at all
> obvious. After all, in the following:
> 
> > % chmod 755 filename
> 
> 755 just looks like an integer, doesn't it?
> 
> Hence the documentation issue. I also suggested, when I ran into this
> problem, that the fact these are octal numbers should be documented. I
> was told that it is documented, in ... I forget where, but someplace
> rather distant from the Unix API doc. I submit that that is inadequate
> documentation for many people.

Well, when doing chmod on the shel, I have in mind this is octal
numbers or the ascii ugo+/-wr.

But when looking in the Ocaml-Unix-Lib-documentation
I only saw the type "int", and when nothing else is mentioned,
int for me is decimal int.

Should be mentioned in the manual!

Information does not make sense when it is not
evaluated in the right context (environment).


[...]
> 
>   Note that [permissions] is an octal number. Example:
> 
>     Unix.chmod 0o755 myfile
> 
> There. That took about 30 seconds.

Yes.

Until today I didn't use Ocaml's octal numbers, because I didn't
needed them.

But to mention this seemingly obvious thing in the reference manual
would be nice. very nice!

Ciao,
   Oliver

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2004-04-23 20:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-23 17:16 Oliver Bandel
2004-04-23 17:45 ` Shawn Wagner
2004-04-23 18:01 ` Richard Jones
2004-04-23 19:14   ` Matt Gushee
2004-04-23 19:34     ` Oliver Bandel [this message]
2004-04-23 20:29       ` Matt Gushee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040423193401.GA1761@first.in-berlin.de \
    --to=oliver@first.in-berlin.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).