Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Ocaml compiler features
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-01-13 (05:37)
From: Edgar Friendly <thelema314@g...>
Subject: Ocaml compiler features
There's a few things I'd like to fix about ocaml, and I should probably
air these and get feedback/help before jumping in and getting lost in
the compiler code.

First, I'd like to fix grouping within the if/then/else construct.  This
is parsed fine:

if y=1 then
	let z = 2 in
	print_int y;
	print_int z;
	print_string "not one"

But the following isn't accepted:

if y=1 then
	print_int y;
	print_int 2;
	print_string "not one"

I understand that the let statement groups the following compound
expression into one statement for the then-clause, so it's a precedence
problem.  Would it really be enough to raise the precedence of ; higher
than that of if/then?  Is there any reason this hasn't been done already?

Second, I have some ideas of things to do with Atomic Variants (sounds
like they could be a monster in a sci-fi movie).  First thing is to
somehow allow the use of a type composed of all Atomic (non-polymorphic)
Variants as an integer type.  One thing I want to do is index arrays
with them.  Yes, I could use records, but then I couldn't iterate across
the structure.

Thanks for listening, and tune in next time for more crazy ideas.