Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "David McClain" <dmcclain@azstarnet.com>
To: <caml-list@inria.fr>
Subject: Re: Return type of procedures?
Date: Mon, 21 Aug 2000 14:58:43 -0700	[thread overview]
Message-ID: <002401c00bba$f9ee4ae0$210148bf@dylan> (raw)

Is it just me? I am quite troubled by the concepts you propose in a new
language. You chose to use Caml for very good reasons. Why would you do away
with things like immutable global environments for your users? Procedures
altering the environment in such a way as to cause a function to behave
differently on separate invocations seems like it is going against the basic
tenets of FP. The FP approach makes it so easy to reason about the behavior
of programs. Partial evaluation allows customization of functions when
needed. Am I missing something here?

- David McClain, Sr. Scientist, Raytheon Systems Co., Tucson, AZ

-----Original Message-----
From: John Max Skaller <skaller@maxtal.com.au>
To: caml-list@inria.fr <caml-list@inria.fr>
Date: Monday, August 21, 2000 2:33 PM
Subject: Return type of procedures?


>I am designing a programming language (the compiler is written
>in ocaml) which is a procedural language with 'purely functional'
>expressions (using eager evaluation). Function closures can
>access their context, which procedural statements my change between
>building the closure and evaulating it. Procedural closures may
>mutate their environment.
>
>Procedures and functions are defined with distinct keywords
>'procedure' and 'function'. I have given a procedure the
>functional type
>
> 'a -> unit (where 'a may sensibly be 'unit')
>
>whereas functions have signature
>
> 'a -> 'b
>
>where either 'a or 'b may be unit. Note that if 'a is unit, the
>function is not necessarily constant, since it may depend on
>the environment. OTOH, a function with 'b as unit is farily
>useless.
>
>However, as it stands, the type system fails to achieve
>separation of functions and procedures:
>
> procedure p: unit -> unit
> function f: unit -> unit
> f (p ())  // woops!
>
>Here is an expression (functional code) which has taken the result
>of calling a procedure (unit) as an argument.
>
>Proposal: just as unit is the trivial product (tuple, terminal object),
>so
>we say 'void' is the trivial sum (initial object), and make procedures
>have the signature
>
> procedure f: unit -> void
>
>Now, procedures cannot be used 'in' expressions anywhere,
>provided we do not allow the argument of a function or procedure
>to have 'void' type. We can also treat procedures uniformly
>from a typing view point.
>
>Comments?
>
>
>--
>John (Max) Skaller, mailto:skaller@maxtal.com.au
>10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
>checkout Vyper http://Vyper.sourceforge.net
>download Interscript http://Interscript.sourceforge.net
>



             reply	other threads:[~2000-08-22  7:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-21 21:58 David McClain [this message]
2000-08-23  6:05 ` John Max Skaller
2000-08-24  8:49   ` Pierre Weis
  -- strict thread matches above, loose matches on Subject: below --
2000-08-22  1:38 Manuel Fahndrich
2000-08-21 21:59 Manuel Fahndrich
2000-08-22  1:17 ` John Max Skaller
2000-08-21 17:17 John Max Skaller

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='002401c00bba$f9ee4ae0$210148bf@dylan' \
    --to=dmcclain@azstarnet.com \
    --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