Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] unused variables warning
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pixel <pixel@m...>
Subject: Re: [Caml-list] unused variables warning
Vitaly Lugovsky <vsl@ontil.ihep.su> writes:

[...]

> > let f x =
> >    let x' = <...> in
> >    x
> >
> > would issue something like
> >
> > File "test.ml", line 2, characters 3-18:
> > Unused variable x'
> 
>  It's "unused" and can be optimized out only when <...> is a pure
> functional statement (not changing global state). 

even if the <...> is unpure, caml could warn that x' is unused. It doesn't mean
in any way that computing x' is unnecessary.

and caml should not warn for

let _x' = <...> in

> There is no clean way to
> figure this out, since we can use foreign functions, and "purity" is not
> specified in a module signature. 'tis a very interesting suggestion:
> specify pure functional and state-changing functions in signatures
> (automaticaly or manualy), and use this info for a better optimizations.

that would be cool, but it's much more complicated than my simple suggestion :)


cu Pixel.
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr