[m-rev.] for review: Uncomment foreign code definition for clock/3.

Sebastian Godelet sebastian.godelet at outlook.com
Wed May 25 11:53:01 AEST 2016


Hello,

Actually I can answer those questions :)

> On Wed, 25 May 2016, Paul Bone wrote:
> 
> > On Tue, May 24, 2016 at 03:38:33PM +0800, Sebastian Godelet wrote:
> >> Hello Paul,
> >>
> >> > diff --git a/library/time.m b/library/time.m index bf4caad..ea9c569
> >> > 100644
> >> > --- a/library/time.m
> >> > +++ b/library/time.m
> >> > @@ -264,16 +264,14 @@ time.clock(Result, !IO) :-  "
> >> >      Ret = (MR_Integer) clock();
> >> >  ").
> >> > -/* XXX need to add System.dll to the references list.
> >> >  :- pragma foreign_proc("C#",
> >> >      time.c_clock(Ret::out, _IO0::di, _IO::uo),
> >> >      [will_not_call_mercury, promise_pure, tabled_for_io],  "{
> >> >      // XXX Ticks is long in .NET!
> >> > -    Ret = (int) System.Diagnostics.Process.GetCurrentProcess
> >> > -        .UserProcessorTime.Ticks;
> >> > +    Ret = (int) System.Diagnostics.Process.GetCurrentProcess().
> >>
> >
> > I'm more concerned about the XXX referring to System.dll.  Is a
> > references list a .NET thing?  Is adding System.dll a problem?

A reference list is a property of a .NET assembly, it is used by the type resolver to load the appropriate assembly for a given type,
This list is generated at compile time. So System.Diagnostics is not included in the mscorlib (.NET standard library), but rather the
System.dll assembly. Both the mono and .NET compiler are clever enough to resolve framework assemblies automatically. During runtime, the System.dll is resolved from the global assembly cache and for mono using a similar mechanism.
So we do indeed not have to worry about this. Reference lists are only a thing for non-framework assemblies like mer_std.dll, which are already handled accordingly.

> 
> I've no idea what that comment is supposed to mean.  It probably doesn't
> matter since it predates the current C# backend, so presuambly whatever it

Yes I assume it is safe to use any type from System(.Collections|.Component|.Text|.Diagnostics|.Threading|.IO|.Core|.Web # only newer versions and probably some others)

> was referring to was actually an issue for the old IL backend.
> 
> Julien.


More information about the reviews mailing list