[Grace-core] Comments on matching

Andrew P. Black black at cs.pdx.edu
Tue Jul 5 15:37:10 PDT 2011


Reading https://projects.cecs.pdx.edu:8443/~black/NewOOL/index.cgi/wiki/GracePatternMatchingCombinators

LiteralPatterns assume that there is == defined between arbitrary pairs of objects. Is == object identity?

I'm confused by the paragraphs that start with

"If we had types, reflection to access them ... the next simplest would be a pattern that tests on type. For this example (in minigrace) I assumed a brand field on every object. A BrandPattern? matches by checking the object's brand."

My confusion is that I don't know from this whether you mean that these patterns (of which I saw no example) are in fact reflective type tests (which means that there should be an explicit mire somewhere, no?) or whether they should be brand tests (which test some aspect of the object's behavior which the designer of that object can control).  To me, this is an absolutely fundamental distinction.

I don't think that your extract method is typeable.  Suppose A has a field a and that AB is a subtype of A with an extra field b.   The A's extract will return an < a >, while AB's extract will return an < a b >, which is presumably not a subtype of < a >.  Or do you mean the result to always be a list of objects of arbitrary length?

The lambda patterns translation stuff was beyond me.

	Andrew



More information about the Grace-core mailing list