From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 0C626BCAC for ; Mon, 22 Mar 2010 19:11:14 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjkEAKNOp0tQDPIagmdsb2JhbACPF4wNFQEBCwsIBxUDH7xOhH0Egx4 X-IronPort-AV: E=Sophos;i="4.51,289,1267398000"; d="scan'208";a="47297790" Received: from smtp20.orange.fr ([80.12.242.26]) by mail3-smtp-sop.national.inria.fr with ESMTP; 22 Mar 2010 19:08:29 +0100 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2003.orange.fr (SMTP Server) with ESMTP id 5DC3420008E2; Mon, 22 Mar 2010 19:08:29 +0100 (CET) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2003.orange.fr (SMTP Server) with ESMTP id 486A7200060B; Mon, 22 Mar 2010 19:08:29 +0100 (CET) Received: from [192.168.1.102] (c-67-188-233-64.hsd1.ca.comcast.net [67.188.233.64]) by mwinf2003.orange.fr (SMTP Server) with ESMTP id D014F20008E2; Mon, 22 Mar 2010 19:08:27 +0100 (CET) X-ME-UUID: 20100322180827852.D014F20008E2@mwinf2003.orange.fr X-ME-User-Auth: padator@wanadoo.fr Subject: Re: [Caml-list] Lazy modules Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=us-ascii From: Yoann Padioleau In-Reply-To: <4BA11E37.7000207@frisch.fr> Date: Mon, 22 Mar 2010 11:08:26 -0700 Cc: David Allsopp , caml-list@yquem.inria.fr Content-Transfer-Encoding: quoted-printable Message-Id: <8307EBEB-28BA-452F-BAF4-06A65DACD9AD@wanadoo.fr> References: <571731.77500.qm@web111510.mail.gq1.yahoo.com> <00d801cac5f9$474281f0$d5c785d0$@romulus.metastack.com> <4BA11E37.7000207@frisch.fr> To: Alain Frisch X-Mailer: Apple Mail (2.1077) X-Spam: no; 0.00; frisch:01 afaik:01 syntax:01 compiler:01 syntax:01 renames:01 toplevel:01 endline:01 runtime:01 functors:01 sub-modules:01 runtime:01 functor:01 recursive:01 functors:01 On Mar 17, 2010, at 11:23 AM, Alain Frisch wrote: >=20 > On 3/17/2010 6:42 PM, David Allsopp wrote: >> AFAIK local modules is a syntax extension not a compiler extension - = I >> expect (not looked at it) that the syntax extension simply alpha = renames >> all the local module declarations to make them unique and puts them >> globally... a very useful extension but no expressive power added. >=20 > This is not true. Local modules are not lifted in any way. This is not = simply a syntax extension. For instance, if the local module has = toplevel side-effects (e.g. a structure item like: let () =3D = print_endline "Hello"), then the side effect will occur every time the = local module is evaluated. >=20 > At runtime, a structure is represented simply by a block with GC tag = 0, exactly as a record or a tuple. Which makes me wonder why people not use simply record or tuples to = solve such problem ... Many times I've found that passing a record of functions was as good as = functors and simply more flexible because they are in the same "value" world.=20 > The block contains dynamic components of the structure (values, = sub-modules, exceptions, classes) in the order given by its signature. = Evaluating a structure simply evaluates its runtime components a build = the block. >=20 > A functor is represented as a function. >=20 >> The module system at present is a compile time feature (I think = that's >> universally true - even with weird things like recursive modules) - >> functors are simply a way of introducing more modules so there is no >> runtime overhead in using a functor. >=20 > Modules and functors are much more dynamic than what you believe. The = introduction of first-class module did not require any change in the way = modules are compiled. >=20 > A local module which is a functor application really applies the = functor at runtime and evaluates the functor body every time the local = module expression is evaluated. >=20 >=20 > Alain >=20 > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >=20