Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: padator@wanadoo.fr
Cc: Florian Weimer <fw@deneb.enyo.de>,
	Damien Guichard <alphablock@wanadoo.fr>,
	caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] The Caml morale crasher #1
Date: Fri, 09 Sep 2005 02:35:59 +1000	[thread overview]
Message-ID: <1126197359.19053.57.camel@rosella.wigram> (raw)
In-Reply-To: <9504834.1126184133428.JavaMail.www@wwinf1536>

[-- Attachment #1: Type: text/plain, Size: 1369 bytes --]

On Thu, 2005-09-08 at 14:55 +0200, yoann padioleau wrote:
> > * Damien Guichard:
> > 
> > > When annoucing an OCaml project on a public forum i have been
> > > advised to renunce lambdas because it would impede translation to "a
> > > less obscure, more popular language".
> > 
> > Most languages offer strictly downward closures.  Even GCC's C
> > implementation has them. 8-)
> 
> Again I think I will disagree on the choice of your words :)
> GCC has nested functions. I think that we can't call that a closure; a closure is something
> that close his environment and store it somewhere. There is no such thing in GCC I think.

My understanding is:

Gcc has first class closures like this stack picture:

closure:
	CALL FUNC
	stack frame here

FUNC:
	POP FP // FP points at the stack frame

Closure's are created by pushing the function
address plus a "CALL" opcode on to the stack,
the SP is then a pointer to the closure.

Execute permission is required for the stack.
Memory management of the thunks, also called
trampolines, is completely automatic.

The closures are valid if, and only if, they're
on the call stack, Damiens 'downward closures':
this means you can pass them as arguments but
not return them, like pointers to any other
local variable in C.

-- 
John Skaller <skaller at users dot sourceforge dot net>


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2005-09-08 16:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-08 12:55 yoann padioleau
2005-09-08 16:35 ` skaller [this message]
2005-09-08 16:44 ` David Brown
2005-09-08 17:14   ` Florian Weimer
  -- strict thread matches above, loose matches on Subject: below --
2005-09-01 16:32 Damien Guichard
2005-09-03  6:06 ` Erik de Castro Lopo
2005-09-07 11:58 ` Matt Gushee
2005-09-07 18:06   ` Damien Guichard
2005-09-07 18:06   ` Damien Guichard
2005-09-08 12:46 ` Florian Weimer

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=1126197359.19053.57.camel@rosella.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=alphablock@wanadoo.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=fw@deneb.enyo.de \
    --cc=padator@wanadoo.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