caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Typing of the sequence operator (;)
@ 2005-11-11 19:33 Lukasz Stafiniak
  2005-11-11 20:12 ` [Caml-list] " Martin Jambon
  2005-11-12  4:11 ` skaller
  0 siblings, 2 replies; 3+ messages in thread
From: Lukasz Stafiniak @ 2005-11-11 19:33 UTC (permalink / raw)
  To: caml users

Dear list,

Why does the sequence operator (;) have type 'a -> 'b -> 'b and not
unit -> 'a -> 'a? There is (ignore) for doing "these things"
purposefully. The toplevel warning is very often mute. Together with
labels, this is a source of bugs.

Best Regards,
Lukasz


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Typing of the sequence operator (;)
  2005-11-11 19:33 Typing of the sequence operator (;) Lukasz Stafiniak
@ 2005-11-11 20:12 ` Martin Jambon
  2005-11-12  4:11 ` skaller
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Jambon @ 2005-11-11 20:12 UTC (permalink / raw)
  To: Lukasz Stafiniak; +Cc: caml users

On Fri, 11 Nov 2005, Lukasz Stafiniak wrote:

> Dear list,
>
> Why does the sequence operator (;) have type 'a -> 'b -> 'b and not
> unit -> 'a -> 'a? There is (ignore) for doing "these things"
> purposefully. The toplevel warning is very often mute. Together with
> labels, this is a source of bugs.

You can use the Camlp4 pa_ru.cmo module which adds type constraints in 
sequences, and is mentioned there:
http://caml.inria.fr/pub/docs/manual-camlp4/manual002.html

So something like that should work:
   ocamlopt -pp 'camlp4o pa_ru.cmo' yourfile.ml


Martin

--
Martin Jambon, PhD - http://martin.jambon.free.fr


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Typing of the sequence operator (;)
  2005-11-11 19:33 Typing of the sequence operator (;) Lukasz Stafiniak
  2005-11-11 20:12 ` [Caml-list] " Martin Jambon
@ 2005-11-12  4:11 ` skaller
  1 sibling, 0 replies; 3+ messages in thread
From: skaller @ 2005-11-12  4:11 UTC (permalink / raw)
  To: Lukasz Stafiniak; +Cc: caml users

On Fri, 2005-11-11 at 20:33 +0100, Lukasz Stafiniak wrote:
> Dear list,
> 
> Why does the sequence operator (;) have type 'a -> 'b -> 'b and not
> unit -> 'a -> 'a? There is (ignore) for doing "these things"
> purposefully. The toplevel warning is very often mute. Together with
> labels, this is a source of bugs.

Yes, I actually think this should be made a hard error.
In transition, a compiler flag to let it pass.

The only place I can see where you might want to 'drop'
a returned value is when interfacing the external world.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-11-12  4:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-11 19:33 Typing of the sequence operator (;) Lukasz Stafiniak
2005-11-11 20:12 ` [Caml-list] " Martin Jambon
2005-11-12  4:11 ` skaller

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