Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Romain Beauxis <toots@rastageeks.org>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Distinguish between osx and linux programmatically
Date: Thu, 8 Jul 2010 12:47:25 -0500	[thread overview]
Message-ID: <201007081247.25427.toots@rastageeks.org> (raw)
In-Reply-To: <20100708170124.GC16057@annexia.org>

Le jeudi 8 juillet 2010 12:01:24, Richard Jones a écrit :
> Actually I misunderstood the link I posted
> (http://www.kernel.org/doc/man-pages/online/pages/man2/uname.2.html#NOTES)
> thinking it meant that the string fields in the structure could have
> variable width.  Reading it again, they don't.

And they are terminated by a '\0' symbol so we can pass them to 
ocaml_copy_string...

> Nevertheless I still think this is not a useful addition to stdlib,
> but for different reasons:
> 
> (1) You'd have to emulate it on non-Unix platforms, but it's unclear
> what you'd emulate it with.  Windows has a completely different and
> much richer concept of OS version.  This sort of version probing
> complexity doesn't belong in the core library, but in an external "OS
> version" library where detection rules can be frequently updated.

Well, we already have emulation for many things in OCaml, including much more 
complex parts of the POSIX/UNIX API, like signals, select, threads etc..

Most of these functions, when not implemented raise a (mostly) undocumented 
exception on Windows..

I see no reason why the uname "emulation" could not as well raise an exception 
when it is not implemented (e.g. under Win32).

> (2) Your program only ever calls out to uname once.  The cost of
> running an external program is negligible.

In the general case, I prefer to avoid running external programs. This is way 
to much OS-dependent. A builting alternative, if available, is always better..


Romain


  parent reply	other threads:[~2010-07-08 17:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-08 10:02 Daniel Bünzli
2010-07-08 10:23 ` [Caml-list] " Richard Jones
2010-07-08 10:48   ` Alex
2010-07-08 11:09     ` Daniel Bünzli
2010-07-08 11:44       ` Richard Jones
2010-07-08 15:42         ` Romain Beauxis
2010-07-08 17:01           ` Richard Jones
2010-07-08 17:17             ` oliver
2010-07-08 17:22               ` David Allsopp
2010-07-08 18:22                 ` Török Edwin
2010-07-08 17:47             ` Romain Beauxis [this message]
2010-07-08 17:23       ` oliver

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=201007081247.25427.toots@rastageeks.org \
    --to=toots@rastageeks.org \
    --cc=caml-list@yquem.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