caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] mutually referencing compilation units
@ 2002-09-15 20:15 Henri Dubois-Ferriere
  2002-09-16  3:44 ` [Caml-list] function polymorphic in number of arguments? Quetzalcoatl Bradley
  2002-09-17 12:32 ` [Caml-list] mutually referencing compilation units Xavier Leroy
  0 siblings, 2 replies; 7+ messages in thread
From: Henri Dubois-Ferriere @ 2002-09-15 20:15 UTC (permalink / raw)
  To: caml-list

hello,
given the banality i'm guessing this question has been asked before .. but
i couldn't find any clear statement related to this inthe archive.

So:
Is the fact that two mutually referencing units can't be compiled
supposed to be a Good Thing? It seems to be a consequence of the fact that
order of .cmo's is relevant, and when that design decision was made i
guess the restriction it entailed on mutual reference was not considered
to be a problem.


Thanks

Henri DF

-------------------
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] 7+ messages in thread

* [Caml-list] function polymorphic in number of arguments?
  2002-09-15 20:15 [Caml-list] mutually referencing compilation units Henri Dubois-Ferriere
@ 2002-09-16  3:44 ` Quetzalcoatl Bradley
  2002-09-16 12:19   ` Francois Thomasset
  2002-09-17 12:32 ` [Caml-list] mutually referencing compilation units Xavier Leroy
  1 sibling, 1 reply; 7+ messages in thread
From: Quetzalcoatl Bradley @ 2002-09-16  3:44 UTC (permalink / raw)
  To: caml-list


Is it possible to make a function of N arguments (3 or more), the first 
two are functions of N-2 arguments, and the function calls the first 
two functions passing its remaining arguments to each of the first two 
functions.  For example

let f1 x = print_string (x ^ "1\n");;
let f2 x = print_string (x ^ "2\n");;

let f a b x = ??? What goes here ???

f f1 f2 "abc";;

result in

abc1
abc2

The trick part is I want the same function f to work if I pass it f1 
and f2 of 2 arguments and pass 4 arguments to f, f1, f2, and two others 
that get passed to f1 and f2.

Thanks for your time,

Quetzalcoatl Bradley
qbradley@blackfen.com
-------------------
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] 7+ messages in thread

* Re: [Caml-list] function polymorphic in number of arguments?
  2002-09-16  3:44 ` [Caml-list] function polymorphic in number of arguments? Quetzalcoatl Bradley
@ 2002-09-16 12:19   ` Francois Thomasset
  2002-09-16 12:24     ` Francois Thomasset
  0 siblings, 1 reply; 7+ messages in thread
From: Francois Thomasset @ 2002-09-16 12:19 UTC (permalink / raw)
  To: Quetzalcoatl Bradley; +Cc: caml-list, thomasse

> Is it possible to make a function of N arguments (3 or more), the first 
> two are functions of N-2 arguments, and the function calls the first 
> two functions passing its remaining arguments to each of the first two 
> functions.
Whar about this one :
let f a b =
  let g x = a x; b x
  in g;;

François Thomasset


-------------------
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] 7+ messages in thread

* Re: [Caml-list] function polymorphic in number of arguments?
  2002-09-16 12:19   ` Francois Thomasset
@ 2002-09-16 12:24     ` Francois Thomasset
  0 siblings, 0 replies; 7+ messages in thread
From: Francois Thomasset @ 2002-09-16 12:24 UTC (permalink / raw)
  To: Francois Thomasset; +Cc: Quetzalcoatl Bradley, caml-list, thomasse, thomasse

> > Is it possible to make a function of N arguments (3 or more), the first 
> > two are functions of N-2 arguments, and the function calls the first 
> > two functions passing its remaining arguments to each of the first two 
> > functions.
> What about this one :
> let f a b =
>   let g x = a x; b x
>   in g;;
> 
> François Thomasset
> 
Sorry I am wrong : my proposal accepts f f1 f2 "abc",
but fails on f g1 g2 "abc" "def"
FT


-------------------
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] 7+ messages in thread

* Re: [Caml-list] mutually referencing compilation units
  2002-09-15 20:15 [Caml-list] mutually referencing compilation units Henri Dubois-Ferriere
  2002-09-16  3:44 ` [Caml-list] function polymorphic in number of arguments? Quetzalcoatl Bradley
@ 2002-09-17 12:32 ` Xavier Leroy
  2002-09-19  3:09   ` John Max Skaller
  1 sibling, 1 reply; 7+ messages in thread
From: Xavier Leroy @ 2002-09-17 12:32 UTC (permalink / raw)
  To: Henri DF; +Cc: caml-list

> Is the fact that two mutually referencing units can't be compiled
> supposed to be a Good Thing?

No, it is acknowledged as an unfortunate limitation and an annoyance
to the programmer.  However, there are deep semantical and
type-theoretical reasons that make it hard to allow cross-module
recursion in ML.  This is actually a research area that is still
largely open.

> It seems to be a consequence of the fact that
> order of .cmo's is relevant

Actually, it's the other way around: the order of .cmo's is relevant
because the ML module system supports only sequential / nonrecursive
definitions of modules, but not parallel / recursive module
definitions.

- 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] 7+ messages in thread

* Re: [Caml-list] mutually referencing compilation units
  2002-09-17 12:32 ` [Caml-list] mutually referencing compilation units Xavier Leroy
@ 2002-09-19  3:09   ` John Max Skaller
  2002-09-19  5:09     ` [Caml-list] ocamlmktop linking on Darwin Lex Stein
  0 siblings, 1 reply; 7+ messages in thread
From: John Max Skaller @ 2002-09-19  3:09 UTC (permalink / raw)
  To: caml-list

Xavier Leroy wrote:

>>Is the fact that two mutually referencing units can't be compiled
>>supposed to be a Good Thing?
>>
> 
> No, it is acknowledged as an unfortunate limitation and an annoyance
> to the programmer.  However, there are deep semantical and
> type-theoretical reasons that make it hard to allow cross-module
> recursion in ML.  This is actually a research area that is still
> largely open.


I'm curious if there is a "lay" explanation of what these restrictions 
are. Felix supports intermodule recursion (with some constraints).
Indeed, there is no explicit construction for sequential module 
definitions (you can do it using nesting).

One of the key distinctions which might make this possible in
Felix is that function declarations:

	fun f(i:int):int { return i; }

do NOT declare values. Thus, the above (which maps semantically
to a C++ class) is quite distinct from

	val g = f;

where g is a function closure
(which maps to C++ object of class f).

The recursion allowed includes type recursion too.

The constraint only applies to open directives
and is related to name lookup, not typing.
Since opening a module may lift a name into the current
scope, there is a constraint on the names of modules
being opened .. since it has to be independent of
the order of opening other modules.



-- 
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] 7+ messages in thread

* [Caml-list] ocamlmktop linking on Darwin
  2002-09-19  3:09   ` John Max Skaller
@ 2002-09-19  5:09     ` Lex Stein
  0 siblings, 0 replies; 7+ messages in thread
From: Lex Stein @ 2002-09-19  5:09 UTC (permalink / raw)
  To: caml-list


Hello,

OSX Darwin's default linker is not GNU ld.  Interestingly,
and unfortunately, Darwin's ld does not like "L .". Ocamlmktop
automatically calls gcc with "L .". Is there any way to tell
ocamlmktop to get rid of the space between the `L` and the `.`?
"L." works just fine.

Here is an example of what happens:

ocamlmktop -verbose -o footop -custom unix.cma \
foo.cma -ccopt "-L/usr/local/foo/lib/"
+ gcc  -o 'footop' -I'/usr/local/lib/ocaml' -L/usr/local/foo/lib/ -L .
/tmp/camlprim4813cc.c  '-L/usr/local/lib/ocaml' '-lcamlfoo' '-ldb' '-lunix'
-lcamlrun
/usr/bin/ld: -L: directory name missing
Error while building custom runtime system
make: *** [footop] Error 2

The following simple example illustrates what happens when the `.`
is moved away from the `L`:

[cstein-4:~/charles] castein% gcc -o foo -L. test.c
[cstein-4:~/charles] castein% gcc -o foo -L . test.c
/usr/bin/ld: -L: directory name missing

I hope that Ocamlmktop can solve this, allowing me to
avoid a non-trivial install of GNU binutils.

Thanks,
Lex




-------------------
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] 7+ messages in thread

end of thread, other threads:[~2002-09-19  5:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-15 20:15 [Caml-list] mutually referencing compilation units Henri Dubois-Ferriere
2002-09-16  3:44 ` [Caml-list] function polymorphic in number of arguments? Quetzalcoatl Bradley
2002-09-16 12:19   ` Francois Thomasset
2002-09-16 12:24     ` Francois Thomasset
2002-09-17 12:32 ` [Caml-list] mutually referencing compilation units Xavier Leroy
2002-09-19  3:09   ` John Max Skaller
2002-09-19  5:09     ` [Caml-list] ocamlmktop linking on Darwin Lex Stein

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