caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Some/None
@ 2002-04-24 12:48 Oliver Bandel
  2002-04-24 13:31 ` Michal Moskal
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Oliver Bandel @ 2002-04-24 12:48 UTC (permalink / raw)
  To: caml-list

Hello,

first time I saw Some- and None-Identifiers
in Sourcecode, answered to my questions,
I thought about it, that it's pseudocode.

I have not found any description in the
Ref-Manual (for 3.01).

Yesterday again Some/None apperaead in the answers to
my questions, and I again looked for it.
In the 3.04-Manual there is no entry for Some/None
in the Index.

After downloading the textversion (oh, I like plaintext :)),
I found Some/None, but not very detailed explained.

How are Some/None defined, what are they good for?

A small, simple example will help a lot.

I found a definition of type option (parametrized type)
in the ocaml-3.04-refman.txt, but the typesystem itself
is new to me, because I'm an Ocaml-beginner.

Can you explain me this type?
It's used in some of the answers to my filesystem-traversing-
question and to understand it completely, I need this
Some-/None-knowledge.

Thanx In Advance,
              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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Caml-list] Some/None
  2002-04-24 12:48 [Caml-list] Some/None Oliver Bandel
@ 2002-04-24 13:31 ` Michal Moskal
  2002-04-24 14:23   ` Oliver Bandel
  2002-04-24 13:41 ` Markus Mottl
  2002-04-24 13:50 ` Oliver Bandel
  2 siblings, 1 reply; 17+ messages in thread
From: Michal Moskal @ 2002-04-24 13:31 UTC (permalink / raw)
  To: Oliver Bandel; +Cc: caml-list

On Wed, Apr 24, 2002 at 02:48:41PM +0200, Oliver Bandel wrote:
> How are Some/None defined, what are they good for?

This is similar in idea to NULL pointer in C. E.g. struct foo *ptr
is NULL iff ptr cannot be assigned any reasonable value of type foo.
You can use 'foo option' in ML the same way -- x : foo option is
None if no foo is the right value for x.

> A small, simple example will help a lot.

let head x =
  match x with
  | h::_ -> Some h
  | [] -> None

Here if no reasoable value of the head of the list can be returned
'None' is used.

I personally use mutable fields in records of option type. They are
initially None, and are filled at some step of computations. However
this is non-functional/ugly/etc ;)

-- 
: Michal Moskal :::::::: malekith/at/pld.org.pl :  GCS {C,UL}++++$ a? !tv
: PLD Linux ::::::: Wroclaw University, CS Dept :  {E-,w}-- {b++,e}>+++ h
-------------------
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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Caml-list] Some/None
  2002-04-24 12:48 [Caml-list] Some/None Oliver Bandel
  2002-04-24 13:31 ` Michal Moskal
@ 2002-04-24 13:41 ` Markus Mottl
  2002-04-24 15:59   ` Oliver Bandel
  2002-04-24 13:50 ` Oliver Bandel
  2 siblings, 1 reply; 17+ messages in thread
From: Markus Mottl @ 2002-04-24 13:41 UTC (permalink / raw)
  To: Oliver Bandel; +Cc: caml-list

Oliver Bandel schrieb am Mittwoch, den 24. April 2002:
> I have not found any description in the
> Ref-Manual (for 3.01).

This type is implicitly defined in the "Pervasives"-module as follows:

  type 'a option = None | Some of 'a

As the name indicates, you can use it to describe optional values, i.e.
you either have "Some value" or you have "None". It has a similar purpose
as NULL-pointers in C, but with the difference that it is perfectly safe
to handle.

When you want to "see" what an optional value looks like, you use
pattern-matching:

  match maybe_data with
  | Some data ->  (* do something with "data" *)
  | None ->       (* handle case when no data available *)

There is no way to accidently access "maybe_data" as if it were "Some
data" even though it is actually "None" - a very common programming
mistake in C.

The option type is really just an ordinary algebraic datatype, which is
useful enough to deserve being defined in the standard library.

LG,
Markus

-- 
Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus
-------------------
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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Caml-list] Some/None
  2002-04-24 12:48 [Caml-list] Some/None Oliver Bandel
  2002-04-24 13:31 ` Michal Moskal
  2002-04-24 13:41 ` Markus Mottl
@ 2002-04-24 13:50 ` Oliver Bandel
  2002-04-24 14:08   ` Xavier Leroy
                     ` (2 more replies)
  2 siblings, 3 replies; 17+ messages in thread
From: Oliver Bandel @ 2002-04-24 13:50 UTC (permalink / raw)
  To: caml-list

Ok,

I try an explanation, and you can comment it.


On Wed, 24 Apr 2002, Oliver Bandel wrote:
[...]
> How are Some/None defined, what are they good for?

To have a boolean choice and depending on that
choice giving back a value of arbitrary type
(or of type option).

> 
> A small, simple example will help a lot.

Hmhhh. I looked again into the answer of John Prevost
(my question on Stack overflow in try-statement)
and I'm close to understanding it.


[...]
> Can you explain me this type?

Hmhh, weell,  errr,, hmmhhh...

The type option gives two choices:
None or Some (== everything (?)).

A condition does not match => None
A condition does match => Some of arbritary type.

The Some/None-identifiers (constructors)
can be used for my is_regularfile-problem
too, I think.

But I have to think about it in more detail.
Does it make sense to give back None/Some
out of a function (e.g. is_regularfile/is_directory/...)
or is it only useful inside functions in
try- and match-statements?


Any correction of the above and any other explanations
are welcome...

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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Caml-list] Some/None
  2002-04-24 13:50 ` Oliver Bandel
@ 2002-04-24 14:08   ` Xavier Leroy
  2002-04-24 19:19     ` Oliver Bandel
  2002-04-24 14:28   ` Remi VANICAT
  2002-04-24 14:55   ` John Max Skaller
  2 siblings, 1 reply; 17+ messages in thread
From: Xavier Leroy @ 2002-04-24 14:08 UTC (permalink / raw)
  To: Oliver Bandel; +Cc: caml-list

Oliver,

I don't want to sound aggressive or condescending or anything like
that, but let me just point you to the last line in every message sent
to this list:

Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

which is a mailing list recently set up just for the purpose of
answering the kind of basic questions that you post to this list.
I'm not saying that your messages are off-topic here, just that they
would be perfectly on-topic there.

- Xavier Leroy
-------------------
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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Caml-list] Some/None
  2002-04-24 13:31 ` Michal Moskal
@ 2002-04-24 14:23   ` Oliver Bandel
  2002-04-24 15:43     ` Samuel Lacas
  0 siblings, 1 reply; 17+ messages in thread
From: Oliver Bandel @ 2002-04-24 14:23 UTC (permalink / raw)
  To: Michal Moskal; +Cc: caml-list

Hello,

On Wed, 24 Apr 2002, Michal Moskal wrote:

> On Wed, Apr 24, 2002 at 02:48:41PM +0200, Oliver Bandel wrote:
> > How are Some/None defined, what are they good for?
> 
> This is similar in idea to NULL pointer in C. E.g. struct foo *ptr
> is NULL iff ptr cannot be assigned any reasonable value of type foo.
> You can use 'foo option' in ML the same way -- x : foo option is
> None if no foo is the right value for x.
> 
> > A small, simple example will help a lot.
> 
> let head x =
>   match x with
>   | h::_ -> Some h
>   | [] -> None
> 
> Here if no reasoable value of the head of the list can be returned
> 'None' is used.

OK, In had typed it into the toplevel and as
expected, it does not give back a pure type
(like int's or strings).
It gives back
 None    
     or
 Some 8
     or
 Some "hello"

If aplicated to an empty list, a list of
integers or a list of strings.

Is this really a commeon way of programming?
If I work on a list of integers or a list of
strings, does it really have advantages to
use such a type?

> 
> I personally use mutable fields in records of option type. They are
> initially None, and are filled at some step of computations.


Hmhh, ok. I now see the similarity to NULL in C.

> However
> this is non-functional/ugly/etc ;)

Pattern match itself is not functional.

How can such things be expressed in a functional
way? (Maybe I have to try it in Haskell, it's
constraints to be functional are much stronger;
when using Ocaml it seems to be that very often
the imperative style creeps in - even unconsciously).

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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Caml-list] Some/None
  2002-04-24 13:50 ` Oliver Bandel
  2002-04-24 14:08   ` Xavier Leroy
@ 2002-04-24 14:28   ` Remi VANICAT
  2002-04-24 14:55   ` John Max Skaller
  2 siblings, 0 replies; 17+ messages in thread
From: Remi VANICAT @ 2002-04-24 14:28 UTC (permalink / raw)
  To: caml-list

Oliver Bandel <oliver@first.in-berlin.de> writes:

> But I have to think about it in more detail.
> Does it make sense to give back None/Some
> out of a function (e.g. is_regularfile/is_directory/...)
> or is it only useful inside functions in
> try- and match-statements?

Really ? it depend. 

in case of is_regularfile/is_directory/... these function seem to be
test, they should return boolean.

more generally, the main question is "is absence of value is very
common, a normal behavior, or is it only a exceptional behavior ?". In
the first case, I will probably use an optional value, and in the
second case I will probably return a plain value, and raise an
exception in the case there is no value.

One can see that it's not widely use in the ocaml library, because most
of the case are better handled by exception. But for example, the weak
array of the module Weak contain value that may disappeared, an so use
the option type.

-- 
Rémi Vanicat
vanicat@labri.u-bordeaux.fr
http://dept-info.labri.u-bordeaux.fr/~vanicat
-------------------
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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Caml-list] Some/None
  2002-04-24 13:50 ` Oliver Bandel
  2002-04-24 14:08   ` Xavier Leroy
  2002-04-24 14:28   ` Remi VANICAT
@ 2002-04-24 14:55   ` John Max Skaller
  2002-04-24 16:49     ` Oliver Bandel
  2 siblings, 1 reply; 17+ messages in thread
From: John Max Skaller @ 2002-04-24 14:55 UTC (permalink / raw)
  To: Oliver Bandel; +Cc: caml-list

Oliver Bandel wrote:

>Does it make sense to give back None/Some
>out of a function 
>
Oh yes! I do this all the time, lots and lots.

Consider

let lst = [1;2;3;4]
let pos lst x =
  let pos lst n = match lst with
    | h :: t ->
      if h = x
      then Some n
      else pos t (n+1)
    | [] -> None
   in
    pos lst 0

which searches a list for a number x,
and returns its position n as 

  Some n 

if it is found in the list, or

  None

if it isn't: its position in the list is None,
it doesn'tr have a position, or Some position
if it does.

>(e.g. is_regularfile/is_directory/...)
>

What you want here is:

    type file_type_t = Regular | Directory | Special | Root | NonExistant

   let file_type (s:string): file_type_t =

    (code to find the file type here) ...

This function finds the type of the file and returns it,
I include the case the file is non-existant.

This is exactly a C enumeration. Only you can have
arguments. For example, an extended file function might
use the construction

    type file_data =
      | Regular of int (* file size in megs *)
      | Directory of int (* number of entries *)
      | Special
    ....

This is a union of cases, just like an enumeration,
only now some extra data is tacked on to some
of the cases.


-- 
John Max Skaller, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850




-------------------
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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Caml-list] Some/None
  2002-04-24 14:23   ` Oliver Bandel
@ 2002-04-24 15:43     ` Samuel Lacas
  0 siblings, 0 replies; 17+ messages in thread
From: Samuel Lacas @ 2002-04-24 15:43 UTC (permalink / raw)
  To: caml-list

Oliver Bandel a écrit 1.8K le Wed, Apr 24, 2002 at 04:23:34PM +0200:
# 
# OK, In had typed it into the toplevel and as
# expected, it does not give back a pure type
# (like int's or strings).
# It gives back
#  None    
#      or
#  Some 8
#      or
#  Some "hello"

Naturally. The type ('int option) is not the same as the type "int",
because you have the "None" value.

# Is this really a common way of programming?

I suppose so.

# If I work on a list of integers or a list of
# strings, does it really have advantages to
# use such a type?

Yes: it allows you to manage an error case for a function supposed to
return a value of type a, but which may sometimes return nothing. It's
lighter than exceptions (I think) and much more safe than having a
"null" pointer-style ugly coding (or other twisted way such as saying
"return -1" if not found).

# Pattern match itself is not functional.

Don't know, but without much thinking, no imperative language having a
similar mechanism built-in comes to my mind. Don't trust me, though :)
 
# How can such things be expressed in a functional
# way? (Maybe I have to try it in Haskell, it's
# constraints to be functional are much stronger;
# when using Ocaml it seems to be that very often
# the imperative style creeps in - even unconsciously).

Haskell preludes contains:

   -- Maybe type
   data  Maybe a  =  Nothing | Just a      deriving (Eq, Ord, Read, Show)

which serves exactly the same. Replace Maybe by option, Nothing by
None, and Just by Some. No "unconscious" imperative creeping here :)

sL

-------------------
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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Caml-list] Some/None
  2002-04-24 13:41 ` Markus Mottl
@ 2002-04-24 15:59   ` Oliver Bandel
  0 siblings, 0 replies; 17+ messages in thread
From: Oliver Bandel @ 2002-04-24 15:59 UTC (permalink / raw)
  To: Markus Mottl; +Cc: caml-list



On Wed, 24 Apr 2002, Markus Mottl wrote:

> Oliver Bandel schrieb am Mittwoch, den 24. April 2002:
> > I have not found any description in the
> > Ref-Manual (for 3.01).
> 
> This type is implicitly defined in the "Pervasives"-module as follows:
> 
>   type 'a option = None | Some of 'a
> 
> As the name indicates, you can use it to describe optional values, i.e.
> you either have "Some value" or you have "None". It has a similar purpose
> as NULL-pointers in C, but with the difference that it is perfectly safe
> to handle.

OK, I see the advantage here: No coredump-problems like in C.

[...]
>   match maybe_data with
>   | Some data ->  (* do something with "data" *)
>   | None ->       (* handle case when no data available *)
> 
> There is no way to accidently access "maybe_data" as if it were "Some
> data" even though it is actually "None" - a very common programming
> mistake in C.

OK, looks like the problem with Unix.ENOENT.

> 
> The option type is really just an ordinary algebraic datatype, which is
> useful enough to deserve being defined in the standard library.

OK.

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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Caml-list] Some/None
  2002-04-24 14:55   ` John Max Skaller
@ 2002-04-24 16:49     ` Oliver Bandel
  2002-04-25  1:46       ` John Max Skaller
  0 siblings, 1 reply; 17+ messages in thread
From: Oliver Bandel @ 2002-04-24 16:49 UTC (permalink / raw)
  To: John Max Skaller; +Cc: caml-list



On Thu, 25 Apr 2002, John Max Skaller wrote:

> Oliver Bandel wrote:
> 
> >Does it make sense to give back None/Some
> >out of a function 
> >
> Oh yes! I do this all the time, lots and lots.
> 
> Consider
> 
[...]
> which searches a list for a number x,
> and returns its position n as 
> 
>   Some n 
> 
> if it is found in the list, or
> 
>   None
> 
> if it isn't: its position in the list is None,
> it doesn'tr have a position, or Some position
> if it does.

OK, that makes sense to me. :)

> 
> >(e.g. is_regularfile/is_directory/...)
> >
> 
> What you want here is:
> 
>     type file_type_t = Regular | Directory | Special | Root | NonExistant

Wow!

Good idea. So I don't rely on the predefined type and use my own :)
That's fine.


> 
>    let file_type (s:string): file_type_t =
> 
>     (code to find the file type here) ...

OK :)

let type_of_file (name:string) =
     try (
           match (Unix.stat name).Unix.st_kind
           with
           | Unix.S_REG   -> Regular
           | Unix.S_DIR   -> Directory
           | Unix.S_CHR   -> Special
           | Unix.S_BLK   -> Special
           | Unix.S_LNK   -> Special (* ok, on ENOENT Unix.lstat *)
           | Unix.S_FIFO  -> Special
           | Unix.S_SOCK  -> Special
         )
      with 
      | Unix.Unix_error (Unix.ENOENT,_,_) -> NonExistant (* maybe link-problem => Unix.lstat *)


So this makes completely sense.


[...]
>     type file_data =
>       | Regular of int (* file size in megs *)
>       | Directory of int (* number of entries *)
>       | Special
>     ....

nice idea. :)


Thanks,
   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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Caml-list] Some/None
  2002-04-24 14:08   ` Xavier Leroy
@ 2002-04-24 19:19     ` Oliver Bandel
  0 siblings, 0 replies; 17+ messages in thread
From: Oliver Bandel @ 2002-04-24 19:19 UTC (permalink / raw)
  To: Xavier Leroy; +Cc: caml-list

Hi,

On Wed, 24 Apr 2002, Xavier Leroy wrote:

> Oliver,
> 
> I don't want to sound aggressive or condescending or anything like
> that, but let me just point you to the last line in every message sent
> to this list:
[...]

Sorry, it was not my intention to annoy the OCaml-gurus with my beginners-
questions.


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Caml-list] Some/None
  2002-04-24 16:49     ` Oliver Bandel
@ 2002-04-25  1:46       ` John Max Skaller
  2002-04-25 12:13         ` Oliver Bandel
  0 siblings, 1 reply; 17+ messages in thread
From: John Max Skaller @ 2002-04-25  1:46 UTC (permalink / raw)
  To: Oliver Bandel; +Cc: caml-list

Oliver Bandel wrote:

>>type file_data =
>>      | Regular of int (* file size in megs *)
>>      | Directory of int (* number of entries *)
>>      | Special
>>    ....
>>
>
>nice idea. :)
>

Perhaps. I would say designing appropriate types
and functions for a system is hard, in any language.

The difference with Ocaml is that representing
your designs is much easier than, say, C or C++.
The language is very expressive and yet compact,
and it is very rarely that I bother representing
a design on paper before coding .. the code is so
expressive of the design it usually isn't necessary ..
in effect, ocaml lets you compile your design
to check it's consistency .. and afterwards
you can execute it .. I'm being extreme here ..
heh .. but only a bit extreme :-)

Just my usual warning .. ocaml is a powerful drug ..
its additive .. a one way street .. ask Markus Mottl ..
you just won't be able to go back to C/C++ afterwards ..
the withdrawal symptoms are quite deadly .. :-))

-- 
John Max Skaller, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850




-------------------
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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Caml-list] Some/None
  2002-04-25  1:46       ` John Max Skaller
@ 2002-04-25 12:13         ` Oliver Bandel
  2002-04-25 12:34           ` Markus Mottl
  0 siblings, 1 reply; 17+ messages in thread
From: Oliver Bandel @ 2002-04-25 12:13 UTC (permalink / raw)
  To: John Max Skaller; +Cc: caml-list

Hello,

On Thu, 25 Apr 2002, John Max Skaller wrote:

> Oliver Bandel wrote:
> 
> >>type file_data =
> >>      | Regular of int (* file size in megs *)
> >>      | Directory of int (* number of entries *)
> >>      | Special
> >>    ....
> >>
> >
> >nice idea. :)
> >
> 
> Perhaps. I would say designing appropriate types
> and functions for a system is hard, in any language.
> 
> The difference with Ocaml is that representing
> your designs is much easier than, say, C or C++.

Yes. I see it.
I have to explore the type-system of Ocaml
and it's facilities more intensive.
It's a wide field.

But I can see, the advantages right now.

But when you have written code in C and Perl
formany years, it's really an unknown land...
C and Perl don't give you results like
"Some 8" or such.
You only have a raw value in C (no matter if it is a
int, char, a function pointer or a pointer to
data of any type (where the types themselves
are never types in theit own right. If using
typedefs in C that is not comparable to the
type-statement of Ocaml.... that's confusing
in the first moment (even if the advantages
will get clearer from time to time))).

It could possible that maybe one day there will be
a C-toplevel, giving back the type of a C-data
(maybe gdb can be used for that). But that is
nothing, what the language itself supports.

So at first contact with Ocaml it seems
strange for C-/Perl-programmers (even
if it's possible to have a slight idea
of what is possible with that typesystem).


> The language is very expressive and yet compact,
> and it is very rarely that I bother representing
> a design on paper before coding .. the code is so
> expressive of the design it usually isn't necessary ..

It's nearly natural language you mean? ;-)


[...]
> Just my usual warning .. ocaml is a powerful drug ..
> its additive ..

I know. I reached the state, where I can acknowledge this.
And I'm prising OCaml wherever I can, even if I only have
a slight insight of it.
Maybe, some weeks or months later I will not ACK that
it's a drug - the typical reaction of a addict people:
"No, I'm not an OCaml-addict. I can stop whith it,
whenever I want to! Really! Believe me! But today I
don't want to stop programming with it... but I could
really, if I wanted to... no, I'Äm not addict..." ;-)


> a one way street .. ask Markus Mottl ..

He's really addict. So he would not say that it's
a drug. ;-)


> you just won't be able to go back to C/C++ afterwards ..
> the withdrawal symptoms are quite deadly .. :-))

:)


I know it.

Even if I stumble in Ocaml right now (but can walk better
than in my last Ocaml-phase, some months ago (I had paused
learning/using it until  the english translation of the
O'Reilly book was published in the net...))

I see the many advantages of it, compared to C.

Always when I look back to C-programming, I know,
that programming paradise is not far away when looking
forward to Ocaml. :)

Ciao,
   Oliver

P.S.: Why not doing some Ocaml-marketing and send a mail to
      Mr. Greeve from the Brave GNU World?
      Doesn't it make sense to make it more public...?
      Or is it better to wait until the OCaml-book will
      be available in the bookshops?

-------------------
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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Caml-list] Some/None
  2002-04-25 12:13         ` Oliver Bandel
@ 2002-04-25 12:34           ` Markus Mottl
  2002-04-25 12:53             ` Jérôme Marant
  0 siblings, 1 reply; 17+ messages in thread
From: Markus Mottl @ 2002-04-25 12:34 UTC (permalink / raw)
  To: Oliver Bandel; +Cc: John Max Skaller, caml-list

Oliver Bandel schrieb am Donnerstag, den 25. April 2002:
> > Just my usual warning .. ocaml is a powerful drug ..
> > its additive ..
> > a one way street .. ask Markus Mottl ..
> 
> He's really addict. So he would not say that it's
> a drug. ;-)

From time to time I use other drugs, too... ;)

LG,
Markus

-- 
Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus
-------------------
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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Caml-list] Some/None
  2002-04-25 12:34           ` Markus Mottl
@ 2002-04-25 12:53             ` Jérôme Marant
  2002-04-25 13:13               ` Markus Mottl
  0 siblings, 1 reply; 17+ messages in thread
From: Jérôme Marant @ 2002-04-25 12:53 UTC (permalink / raw)
  To: caml-list

On Thu, Apr 25, 2002 at 02:34:17PM +0200, Markus Mottl wrote:
> Oliver Bandel schrieb am Donnerstag, den 25. April 2002:
> > > Just my usual warning .. ocaml is a powerful drug ..
> > > its additive ..
> > > a one way street .. ask Markus Mottl ..
> > 
> > He's really addict. So he would not say that it's
> > a drug. ;-)
> 
> From time to time I use other drugs, too... ;)

  Come on, please tell us. This leaves too much place for
  interpretation ;-)

-- 
Jérôme Marant
-------------------
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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Caml-list] Some/None
  2002-04-25 12:53             ` Jérôme Marant
@ 2002-04-25 13:13               ` Markus Mottl
  0 siblings, 0 replies; 17+ messages in thread
From: Markus Mottl @ 2002-04-25 13:13 UTC (permalink / raw)
  To: caml-list

On Thu, 25 Apr 2002, Jérôme Marant wrote:
> On Thu, Apr 25, 2002 at 02:34:17PM +0200, Markus Mottl wrote:
> > From time to time I use other drugs, too... ;)
> 
> Come on, please tell us. This leaves too much place for
> interpretation ;-)

Well, I have already enjoyed a few lines of Haskell. But I did not inhale :-)

Regards,
Markus Mottl

-- 
Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus
-------------------
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


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2002-04-25 13:13 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-24 12:48 [Caml-list] Some/None Oliver Bandel
2002-04-24 13:31 ` Michal Moskal
2002-04-24 14:23   ` Oliver Bandel
2002-04-24 15:43     ` Samuel Lacas
2002-04-24 13:41 ` Markus Mottl
2002-04-24 15:59   ` Oliver Bandel
2002-04-24 13:50 ` Oliver Bandel
2002-04-24 14:08   ` Xavier Leroy
2002-04-24 19:19     ` Oliver Bandel
2002-04-24 14:28   ` Remi VANICAT
2002-04-24 14:55   ` John Max Skaller
2002-04-24 16:49     ` Oliver Bandel
2002-04-25  1:46       ` John Max Skaller
2002-04-25 12:13         ` Oliver Bandel
2002-04-25 12:34           ` Markus Mottl
2002-04-25 12:53             ` Jérôme Marant
2002-04-25 13:13               ` Markus Mottl

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).