The madness of implicit parameters: cured?

Ashley Yakeley ashley@semantic.org
Sun, 03 Aug 2003 10:54:37 -0700


In article <Pine.LNX.4.21.0308020030420.6841-100000@dark.darkweb.com>,
 Ben Rudiak-Gould <benrg@dark.darkweb.com> wrote:

> Now we have something almost the same as the current implicit-parameter
> system, except that it behaves in a much safer and saner way.

Hmm... you have this:

 [?x,?x] {@x=1} -- OK
 [?x] {@x=1} -- OK
 [] {@x=1} -- not OK

You've disallowed the last one in an attempt to prevent ambiguity. 
However, not only is this ugly, it isn't sufficient. Consider this:

 let ?x = 1 in ((let g = \_ _ -> ?x in let ?x = 2 in g ?x) ?x)

converts to:

 ((let g = \_ _ -> \@x -> @x in ((g (\@x -> @x)) {@x = 2})) (\@x -> 
@x)){@x = 1}

1. do  @-application first

 ((let g = \_ _ -> \@x -> @x in (g 2)) (\@x -> @x)){@x = 1}
 (((\_ _ -> \@x -> @x) 2) (\@x -> @x)){@x = 1}
 ((\_ -> \@x -> @x) (\@x -> @x)){@x = 1}
 (\@x -> @x){@x = 1}
 1

2. do let-substitution first

 ((((\_ _ -> \@x -> @x) (\@x -> @x)) {@x = 2}) (\@x -> @x)){@x = 1}
 (((\_ -> \@x -> @x) {@x = 2}) (\@x -> @x)){@x = 1}
 ((\_ -> 2) (\@x -> @x)){@x = 1}
 (\_ -> 2) 1
 2

Again, it all depends on the type of 'g'.

-- 
Ashley Yakeley, Seattle WA