On Sat, Dec 27, 2014 at 1:58 PM, Matt Oliveri <[email protected]> wrote:

> On Sat, Dec 27, 2014 at 1:50 PM, Jonathan S. Shapiro <[email protected]>
> wrote:
> > Assume that tuples are unboxed. If that's the case, then I can form an
> > offset for ( 5.6247, "abc" )#2 just as easily as I can form the offset
> for
> > (5.6247, "abc").snd. This is true because the indexing expression is a
> > literal, not a variable. That's the kind of thing I'm saying when I talk
> > about literal identifiers. Identifiers as actual values is another matter
> > entirely.
>
> Ah I see. In that case, it seems fine, but then I don't see what it's
> buying you.
>

Maybe nothing. I was just thinking about all of the various forms of case
analysis over name matching in the BitC compiler and shuddering, looking
for a way to reduce the core type system.

Well, that and we already have a kludge in the compiler to deal with
HasField that wouldn't be necessary if we had a literal identifier notion.


> >> But copy-and-update does seem like adding environment entries,
> >> assuming the type is allowed to change. (I guess I'm not following
> >> your train of thought, from copy-and-update to literal identifiers.)
> >
> > The type only changes if new field names are introduced by the
> > copy-and-update operation, or if the type of an existing field name is
> > altered (comparable to shadowing with let).
>
> Right, that's the similarity. I was confirming that you could change
> the type associated with a name--like shadowing with let--since I
> haven't read the F# spec.
>

The copy-and-update operation in F# can neither add fields nor re-type a
field. I was mostly noting that there's a close relationship between
update, shadowiing, and extension.


>
> > What I'm saying about literal identifiers in the copy-and-update context
> is
> > that when we see something like
> >
> > (r:'R) with myField = 42.3
> >
> > we can view the "with" as a polymorphic ternary function:
> >
> > HasField('R :: Record, 'id :: Ident, 'fieldType) =>
> > with: 'R -> 'id -> 'fieldType
>
> Maybe I don't know this notation. Where is the return type?
>

I'm using something akin to Haskell notation above, but I messed up. In the
copy-and-update case i should have written:

HasField('R :: Record, 'id :: Ident, 'fieldType) =>
with: 'R -> 'id -> 'fieldType -> 'R

That is:/with/ returns a record of the same type that you started with.


shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to