Hi,

given the two modules

\begin{code}
module A (a) where 

primitive prim_a :: Int -> IO (Int, Int)

a x = do
  r <- prim_a x
  print x

needPrims_hugs 2
\end{code}

\begin{code}
module Main where

import A
primitive prim_a :: Int -> IO Int

main = do
   prim_a 2 >>= print
   print (a 2)

needPrims_hugs 2
\end{code}

The result of running Main.main is

(2,3)
(2,3)

i.e., "primitive" decls don't appear to honour the module system
at all - first primitive name that matches in the linked list of
prim-tables is used. How bad. (yes, this is based on a real
example - just spent a couple of hours tracking down a bug
related to this).

Having Hugs at least check for duplicates in registerPrims()
would be preferable, as is, users of HDirect and GreenCard run
the risk of accidentally&mysteriously losing here. (I'm surprised
it hasn't come up before...or is this a known potential problem?)

--sigbjorn

Reply via email to