English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] getting the value of the first expression
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-10-18 (10:08)
From: Dmitry Lomov <dsl@t...>
Subject: Re: [Caml-list] getting the value of the first expression
Hi Rafael, 
On Thu, 18 Oct 2001, Rafael 'Dido' Sevilla wrote:

> it's needed in my compiler.  Say I have a group of functions like this.
> emit_parm "ldc" offset;
> emit "ind"
> The value of this whole expression is the value of the emit application.
>  What if I want the value of the entire expression to be the value of
> the emit_parm application?  I can't interchange the order of these two
> expressions obviously because the two function applications have side
> effects (they generate the assembly language for my virtual machine
> architecture) Is there a way to do this?  I've been able to work around
> my ignorance of the existence of such a feature but I can't help but
> feel that there *must* be a better way.

The better way is:

let value = emit_parm "ldc" offset in
emit "ind"; value

Dmitry Lomov / Lanit-TERCOM Inc.
Phone: +7(812)428-45-24
e-mail: dsl@tepkom.ru

Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr