Changes between Version 53 and Version 54 of DataParallel/ClosureConversion/ClassLess
 Timestamp:
 May 1, 2007 8:04:56 AM (8 years ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

DataParallel/ClosureConversion/ClassLess
v53 v54 113 113 toArr f = const (tob . f . fra) :$ () 114 114 frArr (f :$ e) = frb . f e . toa 115 }}} 116 117 === Conversions === 118 119 To perform the actual conversion of values of a type `t::*`, we generate a conversion `iso<t>` of type `t :<>: t^` as follows: 120 {{{ 121 iso<T> = isoT , if T_CC exists 122 = idIso<*> , otherwise 123 iso<a::k> = idIso<k> 124 iso<t1 > t2> = idIso<*> , if kindOf t1 == # 125 or kindOf t2 == # 126 = isoArr , otherwise 127 iso<t1> iso<t2> 128 iso<t1 t2> = iso<t1> iso<t2> 129 iso<forall a.t> = iso<t> 130 }}} 131 where 132 {{{ 133 idIso<*> = id :<>: id 134 idIso<k1>k2> = \_ > (idIso<k2>) 115 135 }}} 116 136 … … 255 275 * We come across a dfun: If its `idCC` field is `NoCC`, we keep the selection as is, but apply `convert t e` from it, where `t` is the type of the selected method and `e` the selection expression. If `idCC` is `ConvCC d_CC`, and the dfun's class is converted, `d_CC` is fully converted. If it's class is not converted, we also keep the selection unconverted, but have a bit less to do in `convert t e`. '''TODO:''' This needs to be fully worked out. 256 276 257 === Generating conversions ===258 259 Whenever we had `convert t e` above, where `t` is an unconverted type and `e` a converted expression, we need to generate some conversion code. This works roughly as follows in a type directed manner:260 {{{261 convert T = id , if tyConCC T == NoCC or AsIsCC262 = to_T , otherwise263 convert a = id264 convert (t1 t2) = convert t1 (convert t2)265 convert (t1 > t2) = createClosure using (trevnoc t1)266 and (convert t2) on argument and result resp.267 }}}268 where `trevnoc` is the same as `convert`, but using `from_T` instead of `to_T`.269 270 The idea is that conversions for parametrised types are parametrised over conversions of their parameter types. Wherever we call a function using parametrised types, we will know these type parameters (and hence can use `convert`) to compute their conversions. This fits well, because it is at occurences of `Id`s that have `idCC == NoCC` where we have to perform conversion.271 272 The only remaining problem is that a type parameter to a function may itself be a type parameter got from a calling function; so similar to classes, we need to pass conversion functions with every type parameter. So, maybe we want to stick `fr` and `to` into a class after all and requires that all functions used in converted contexts have the appropriate contexts in their signatures.273 277 274 278 === TODO ===