From: Tobias C. R. <tc...@fr...> - 2010-02-28 10:17:09
|
Nikodemus Siivola <nik...@ra...> writes: > > > I think I would prefer if in case of function objects the derived type > > > was always used, and in case of names the declared type -- or > > > alternatively having a separate FUNCTION-DECLARARED-TYPE and > > > FUNCTION-DERIVED-TYPE. > > > > I added FUNCTION-TYPE to return the most specific type information > > available because that's my use case. I don't mind the splitting. > > That's the rub: the declaration is neither necessarily more specific, > nor always accurate. Yes, actually my use case is not to have the most specific type, but the type the user specified, or if not available the derived type. I.e. I want something like (OR (FUNCTION-DECLARED-TYPE <fun>) (FUNCTION-DERIVED-TYPE <fun>)) > My use case (though I'm using %FUN-TYPE directly, so this is not > hurting me right now) is to check that the derived "real" type of a > function is a subtype of the right type before I put it in a place > where it results will be used without typechecking later on, etc. I'm using it in declarations-as-assertions and declarations-as-documentation purposes, so I'm mostly interested in the thing the programmer said. > You're right in that structure accessors are a hairy case, since the > closure does actually check the exact type, but %FUN-TYPE doesn't know > that. Are there other cases like this? If not, maybe just > special-casing for structure accessors might work. I did that at first. Didn't strike me as the Right Thing. The explicit split looks like a good thing because it's more primitive and people can use it to build their own stuff on top. -T. |