This wiki has undergone a migration to Confluence found Here
<meta name="googlebot" content="noindex">

Datatypes R2 Issue 97

From HL7Wiki
Revision as of 01:21, 17 May 2007 by Gschadow (talk | contribs)
Jump to navigation Jump to search

= Type.implies nullNess question

Introduction

A possible mistake in the definition of DataType:

private type DataType alias TYPE specializes DataValue {
   CS  shortName;
   CS  longName;
   BN  implies(TYPE that);
};

in the UML i missed the parameter that on implies, but is the result really a BN not a BL?

if that is null, then the result must null, no?


Skype chat

[10:27:53 AM] Grahame Grieve says: noticed a mistake in the definition of DataType [10:28:19 AM] Grahame Grieve says: private type DataType alias TYPE specializes DataValue {

  CS  shortName;
  CS  longName;
  BN  implies(TYPE that);

}; [10:28:30 AM] Grahame Grieve says: in the UML i missed the parameter that on implies. [10:28:41 AM] Grahame Grieve says: but is the result really a BN not a BL? [10:29:16 AM] Lloyd McKenzie says: Can implies be unknown? [10:29:16 AM] Lee Coller says: Wha'ts the case where it could be null? [10:29:39 AM] Lloyd McKenzie says: That would suggest our spec was confusing . . . :) [10:30:28 AM] Grahame Grieve says: if that is null, then the result must null, no? [10:31:02 AM] Lloyd McKenzie says: So you've got an implies(null))? [10:31:23 AM] Lee Coller says: I'd rather constrain that to be not null [10:31:50 AM] Lloyd McKenzie says: But you can't pass null as a parameter. [10:31:56 AM] Lloyd McKenzie says: "null" isn't a type [10:32:10 AM] Lee Coller says: no, but type can be null [10:32:21 AM] Lee Coller says: I mean yes, but type can be null [10:32:26 AM] Grahame Grieve says: well, why? See, the thing is that this is a bit of a quanfary. you can pass null as a parameter - eery single function. it will just return null, except in a few cases (isNull etc) [10:32:52 AM] Grahame Grieve says: you can't stop an operation from getting a null parameter. just define that it returns null. but BN cannot be null [10:33:04 AM] Lloyd McKenzie says: You can pass an instance that *is* null. That's different [10:33:18 AM] Lloyd McKenzie says: Can TYPE be null? [10:33:24 AM] Grahame Grieve says: so null.dataType() != null? how do you figure that? [10:33:43 AM] Lloyd McKenzie says: I would say that Type.isNull should be constrained to always be false [10:33:45 AM] Grahame Grieve says: the definition of null is the supertype of all known types. So null.dataType == null by definition [10:33:57 AM] Lloyd McKenzie says: "null" isn't a type [10:34:06 AM] Lloyd McKenzie says: null is a property on ANY [10:34:25 AM] Grahame Grieve says: so I say Lloyd is wrong. Check the OCL definition. This is the mist applicable one. I think we need to clarify this [10:34:40 AM] Lee Coller says: Looking at the ADT R1 I see that under Type has it as BN, but BL has it as BL. I think we go with BL, true null is a degenerate case, but we need to support it. [10:34:52 AM] Grahame Grieve says: null is a property "on" any. It's a feature of the thing itself [10:35:20 AM] Lloyd McKenzie says: Right. It's a property, not a type [10:35:31 AM] Lloyd McKenzie says: Thus it can't be passed as an argument [10:35:42 AM] Grahame Grieve says: what? huh? [10:35:58 AM] Grahame Grieve says: nulls can be parameters, it's a logical consequence of how things work [10:36:15 AM] Lee Coller says: null can be passed as a paremeter, I do it all the time (sometimes even when I shouldn't) [10:36:42 AM] Lee Coller says: The question is the behavior, in java I can throw an exception, but that isn't the case here, I must return a value, that value should be null. [10:37:11 AM] Lee Coller says: That's a nice way of saying Lloyd is wrong :) [10:37:14 AM] Grahame Grieve says: yes, null takes the place of exception. and it works nicely too [10:37:26 AM] Grahame Grieve says: hey all, beat up on Lloyd. If only Gunther was here... [10:37:35 AM] Lloyd McKenzie says: :P [10:37:49 AM] Lee Coller says: Checking the old ADT, I see its wrong there too, datatype has implies as BN, all the other types have it as BL [10:38:28 AM] Grahame Grieve says: yeah, Gunther and I agreed that you could never be unsure whether one type implied another. But we missed the obvious case where etither this or that was null [10:39:37 AM] Grahame Grieve says: I've felt in the past that this is a deficit in the way that null is defined - a la Java, a null type still has an implicit type from the context. But this can only be true in an explicitly typed language, and OCL and the abstract datatypes are not explicitly typed in that sense - even though at first glance it appears that they are [10:40:28 AM] Lee Coller says: I' [10:41:10 AM] Grahame Grieve says: LLoyd says: Why can't we say that TYPE.isNull.implies(false)? Then you can't pass a null type in [10:41:30 AM] Grahame Grieve says: actually, you could still pass a null in, but it returns false [10:41:39 AM] Lloyd McKenzie says: How? [10:41:53 AM] Grahame Grieve says: sorry. misread. [10:41:54 AM] Lloyd McKenzie says: "null" isn't a thing in the abstract datatype specs [10:42:07 AM] Grahame Grieve says: so, we say datatype.notNull() [10:42:28 AM] Lloyd McKenzie says: There's no concept of "null". There's only a concept of a datatype instance that says a datatype "isNull" or has a particular null flavor. [10:42:40 AM] Grahame Grieve says: I disagree outright with that. completely [10:42:43 AM] Lee Coller says: I'd be happy adding a constraint, if x.isNull() then x.dataType.isNull() [10:42:56 AM] Lloyd McKenzie says: All you can ever do is pass a datatype that isNull or isNotNull. You can't pass "null" [10:43:03 AM] Lloyd McKenzie says: You can in Java, but not in abstract datatypes [10:44:18 AM] Lee Coller says: I agree with Grahame [10:45:13 AM] Grahame Grieve says: I'm just reassessing. Lloyd's concept that there is no true null, only a typed thing with null - I'm thinking about that. It's a pretty radical idea for me. I'm concerned about the implications [10:45:23 AM] Lloyd McKenzie says: If I give you a GTS and it "isNull", then it's still a GTS [10:45:27 AM] Lee Coller says: Type specializes ANY, thus there is Type.isNull() etc. [10:45:56 AM] Lee Coller says: Philosophically I disagree with Lloyd, but I see where he is getting that out of the ADT spec [10:46:22 AM] Lloyd McKenzie says: There is a Type.isNull(), however we can assert that's not allowed [10:47:06 AM] Lee Coller says: If we can assert its not allowed, then we can have BN implies(TYPE that) [10:47:18 AM] Lloyd McKenzie says: Exactly [10:47:36 AM] Lloyd McKenzie says: And I can't think of a reason why we should ever support TYPE.isNull = true [10:48:08 AM] Lee Coller says: We can constraint Type.isNull = false, then the issue goes away [10:49:09 AM] Lloyd McKenzie says: Exactly :) [10:49:45 AM] Lee Coller says: Now, is the type of a null value ever significant? [10:50:31 AM] Lee Coller says: For example, if an INT value has a null flavor of TRC, does that imply anything?

Motion It's BL

For: Grahame, Lee, Gunther
Against: Lloyd
Abstain: