Skip to content

How to conceptualize subtyping for legacy-nullness #33

Closed

Description

@kevinb9n

It's beyond debate that @NotNull Foo <: @Nullable Foo. When @LegacyNull Foo comes in, well, it should still be uncontroversial that assigning from not-null to legacy is safe, and that assigning from legacy to nullable is safe.

But then the questions of assigning legacy to not-null, and/or assigning nullable to legacy, are not as clear. I would say there are two choices of rule sets that both make good sense:

(1) The strict interpretation: neither of these cases is assignable; both are unsound.

(2) The lenient interpretation: both are assignable, because we don't have enough basis for complaint and we will annoy users.

Interestingly, (1) leads to a "normal" subtype arrangement of not-null <: legacy <: nullable where the anti-symmetric property is preserved. (2) leads to breaking not just anti-symmetry but also transitivity (we want nullable <: legacy and legacy <: not-null but we don't want nullable <: not-null!).

I think a clean solution may be this: assignability rules really are defined conservatively as in (1). But we also have something akin to Java's "unchecked conversion". Even though nullable </: legacy and legacy </: not-null, you can still make that conversion anyway IF you @SuppressWarnings("nullness:legacy") (let's not debate the name though).

What's nice about this is that projects can decide whether they want to be strict or lenient based on whether they apply that warning suppression at a broad level or not. I think it's also much easier to think about this way, rather than saying only "not-null <: nullable but legacy is a special thing sitting off to the side somewhere".

Activity

  1. wmdietlGC commented on Jun 21, 2019

    @wmdietlGC
    Collaborator

    I'm wondering whether we can simply say that assignability only matters in method bodies and we don't talk about how method bodies are defaulted and what rules are checked.

    So maybe it is enough to decide what the relationship should be for behavioral subtyping.
    Using the usual behavioral subtyping rules, parameter types in an overriding method can become supertypes and return types can become subtypes.

    Using not-null <: legacy <: nullable would make sense for this: a method with a legacy parameter and legacy return type can be safely overridden by a method that takes a nullable parameter and a non-null return type. It is dangerous to e.g. use a not-null parameter type, because existing invocations might pass legacy values. So an error should be issued that would need to be suppressed.

  2. kevinb9n commented on Jun 21, 2019

    @kevinb9n
    CollaboratorAuthor

    I don't think it will hold up that "assignability only matters in bodies"; first because of the case you show, but also the way I choose what types to use as parameter types is by deciding what set of types I want users to be able to pass for those -- what must they be assignable to; and vice-versa for return types.

    I agree with your last paragraph; it seems to work well. (This is, incidentally, one reason in favor of allowing contravariant parameter types -- it enables reasonable annotated extensions of unannotated base classes.)

  3. stephan-herrmann commented on Aug 2, 2019

    @stephan-herrmann

    But we also have something akin to Java's "unchecked conversion". Even though nullable </: legacy and legacy </: not-null, you can still make that conversion anyway IF you @SuppressWarnings("nullness:legacy") (let's not debate the name though).

    👍

    (named "null-unchecked", or "unchecked-null" in another issue, in perfect analogy to @SuppressWarnings("unchecked")).

  4. cpovirk commented on Aug 2, 2019

    @cpovirk
    Collaborator

    Has there been further discussion of @LegacyNull inside parameterized types? I still worry that it's too easy to just say "@LegacyNull T -> @NotNull T is a warning" without having a story in place for List<@LegacyNull String> -> List<@NotNull String>.

  5. cpovirk commented on Aug 2, 2019

    @cpovirk
    Collaborator

    I found a comment by @kevinb9n that suggests that he intends the above to permit the List<@LegacyNull String> -> List<@NotNull String> conversion. If so, I think we need to be more precise about the analogy to Java's "unchecked" warnings: List<Object> -> List<String> isn't an unchecked conversion: It's an "incompatible types" error. Maybe the case we need to think about is raw types? List -> List<String> produces an unchecked warning (along with a rawtypes warning from declaring the raw List in the first place). But I'm not sure that even that is a perfect analogy: List<List> -> List<List<String>> is an "incompatible types" error, but it seems like we'd want to allow List<List<@LegacyNull String>> -> List<List<@NotNull String>>? Hmm, am I even making sense here? :) I think my main point remains that I don't think we have this specified yet. And that might be how everyone sees it. But maybe this is something we need to figure out soonish for prototype checkers?

  6. kevinb9n commented on Aug 2, 2019

    @kevinb9n
    CollaboratorAuthor

    I believe Chris's comment is accurate about the state of things. The explanation of unchecked conversions above does not tell the whole story.

    For example, a parameter accepts List<@NotNull String> but caller passes List<@NullnessUnknown String>. I think we want a warning here that prompts the user to make sure they definitely don't have nulls in the list. This warning can probably be suppressed via the same string as other unchecked warnings like SuppressWarnings("nullness-unchecked") or whatever.

    Spec is trying to talk about this issue here:
    https://docs.google.com/document/d/15NND5nBxMkZ-Us6wz3Pfbt4ODIaWaJ6JDs4w6h9kUaY/edit#bookmark=id.fanc9juivg8a
    See what you think.

  7. cpovirk commented on Aug 5, 2019

    @cpovirk
    Collaborator

    Thanks for the link to the spec. I had missed that update.

    The goal of the spec sounds good to me. I haven't thought about it super deeply, partially because I haven't gotten around to it but partially because:

    I'm wondering how easy the spec is going to be to translate into code. Is it "Run the magic type inference algorithm, and if it fails, then run it again 3^n times, where n is the number of @NullnessUnknown type components in the expression in question (and 3 is @NotNull+@Nullable+@NullnessUnknown), and if more than one of those combinations works, then pick one of them arbitrarily?" (Or consult code later in the method to see which works best? I'm (again) extremely ignorant of how the flow-sensitive typing works.)

    Maybe I am making this sound harder or less efficient than it really is. (I will stress yet again how ignorant I am of in-method type inference :)) I don't want to force anyone to inline the whole type-inference algorithm into the spec to handle this one case :) The text just feels a little hand-wavy to me at this point.

  8. cpovirk commented on Aug 6, 2019

    @cpovirk
    Collaborator

    Some FUD for you all: 🙂

    In a discussion of erasure, Maurizio Cimadamore says that it's hard to do better than erasing everything. Now, part of the reason for that is that it's a change to an existing spec, and it's not clear exactly how close a match that is for what we're talking about here. But I will cite it anyway because it supports my worldview ;)

    That gets me wondering if the rule should be: "If any type contains @NullnessUnknown and the type-checking would otherwise fail, redo the type checking while ignoring nullness completely. If that simpler check passes, then issue a warning." (And of course, if it fails, then fail.)

    If we did want to be more complex than that, we may need to consider 3 cases separately:

    1. Tweaking the type of a parameter in an overridden method
    2. Tweaking the return type of an overridden method
    3. Full-on type inference

    (1) might be easier: There might be no need for a full-on assignability / subtyping analysis, so it might be as simple as the spec currently makes it sound. For reference:

    In addition, “unchecked conversions” between @NullnessUnknown and either other nullability may also be permitted, even for invariant type components.

    (2) gets trickier, since return types can be covariant.

    (3) is like (2) but maybe harder? Fortunately, it's out of scope for our main work here. Still, we should be conscious of whether we're making decisions that assume (3) can be implemented in a particular way.

  9. cpovirk commented on Aug 14, 2019

    @cpovirk
    Collaborator

    Maybe I'm overstating things: Java doesn't erase everything the moment it sees a raw type. For example, the following is still an error:

    List<List> x = ...;
    List<List<?>> y = x;

    So my proposed rule is less sophisticated than what Java does for raw types (to the extent that it's fair to consider the two to be so similar). But maybe our rule has to be different than what Java does for raw types, since we want to allow conversions much like these? If so, the lesson here may be that we either have to do something simpler than how Java handles raw types or more complex. I know what my leaning would be :)

    Java does erase aggressively when calling a method on a raw type, but I'm not confident I've found all the relevant parts of the spec. I see some places that mention erasing the return type and throws types (15.12.2.6, 18.5.2.2), triggered by unchecked conversion (of the receiver or parameters?), described in 5.1.9. That might cover much of it.

  10. stephan-herrmann commented on Aug 15, 2019

    @stephan-herrmann

    I see some places that mention erasing the return type and throws types (15.12.2.6, 18.5.2.2), triggered by unchecked conversion (of the receiver or parameters?), described in 5.1.9. That might cover much of it.

    18.5.2.2 refers to unchecked conversion used anywhere during type inference (esp. reduction of type constraints), which is a wide field....

  11. stephan-herrmann commented on Aug 15, 2019

    @stephan-herrmann

    But I'm not sure that even that is a perfect analogy: List -> List<List> is an "incompatible types" error, but it seems like we'd want to allow List<List<@LegacyNull String>> -> List<List<@NotNull String>>?

    For any type arguments rules apply that are much stricter than compatibility, more like equality. See e.g., the notation ‹S <= T› in JLS 18.1.2 and its use in 18.2.3.

  12. cpovirk commented on Aug 19, 2019

    @cpovirk
    Collaborator

    If I understood correctly, @abreslav suggested in our meeting that Kotlin platform types permit the conversions between List<@UnknownNullness T> and List<@NotNull T> discussed above. Does anyone know if there's a public spec for platform-type conversions? I see a definition in the docs, but I don't think it goes into this level of detail.

  13. cpovirk commented on Aug 19, 2019

    @cpovirk
    Collaborator

    If I understood correctly, @abreslav suggested in our meeting that Kotlin platform types permit the conversions between List<@UnknownNullness T> and List<@NotNull T> discussed above. Does anyone know if there's a public spec for platform-type conversions? I see a definition in the docs, but I don't think it goes into this level of detail.

    This seems to tie into "flexible types" (design doc). In nullability terms, perhaps @UnknownNullness T is (@Nullable T, @NotNull T)? The spec has some assignability rules and I gather some special rules for overriding methods. I haven't tried to absorb more than that, since I'm not sure if I'm even looking in the right place :)

    [edit: more links in #24, including slides]

    [edit: flexible types (plus their subtyping rules, followed by LUB and GLB) and platform types in the Kotlin spec]

  14. cpovirk commented on Aug 20, 2019

    @cpovirk
    Collaborator

    (The Kotlin precedent does make me feel overall more optimistic that there's a solution here, at least in the common case of "fully nullness-unknown" types like @UnknownNullness Foo<@UnknownNullness Bar<@UnknownNullness Baz>>. A mixture of known and unknown nullness in a single type might be harder, but it should also be less common, and it might well Just Work, too.)


    [edit: unrelated update: cross-link to related email discussion]

  15. cpovirk commented on Sep 12, 2019

    @cpovirk
    Collaborator

    (probably nothing new here, just dumping thoughts)

    As discussed over email, we will need to distinguish clearly between assignability and subtyping.

    static <T extends @NullUnspecified Object> doSomething(T object) { ... }
    ...
    doSomething(null);

    As noted in the bug linked from the email, the bounds are supposed to be checked (15.12.2.2 and 15.12.2.3) using subtyping (<:, 4.10), not assignability. Now apparently the bounds aren't checked that way in the case of method calls, at least not completely, but the bug mentions the example of type arguments to generic classes, which apparently are checked right:

    class Foo<T extends @NullUnspecified Object> {
      Foo(T t) { ... }
    }
    ...
    new Foo<>(null);

    It seems highly unlikely that we can sensibly define @Nullable to be a subtype of @NullUnspecified, so the type of that constructor-call expression isn't going to be Foo<@Nullable Object>. We'd probably like to infer the type to be Foo<@NullUnspecified Object> and then warn about the unchecked conversion of null to @NullUnspecified Object. I have no idea if that's workable (though, if not, users can presumably cast null explicitly). On top of that, users are probably still unable to express Foo<@Nullable Object> as a type in variables, etc. This ties in to #45 (comment). (Foo<@NotNull Object>, by contrast, is probably still fine to permit if we want.)

    This may also be more reason to think that @NullUnspecified isn't a "type" so much as it is a pseudo-type parameter or wildcard (#69). Not that I see any way for that to help users express Foo<@Nullable Object> or avoid casts/conversions to @NullUnspecified :\ (Maybe casts will even produce two warnings, one for the cast and one for the call (if every usage of @NullUnspecified ends up being a warning).)

    Or maybe Kotlin's flexible types hold the key -- if we can apply them to Java.

  16. 49 remaining items

  17. kevinb9n commented on May 29, 2020

    @kevinb9n
    CollaboratorAuthor

    I should have mentioned that I do think we very often forget to think about that line on a daily basis, and it's right to call our attention to it so we can make sure we're respecting it.

    I guess I can't really picture how tools could choose different subtyping rules unless they were also assuming different meanings for our annotations themselves. Or how they could do so without putting an API owner in the position of having to choose whether to make their X-tool users or their Y-tool users happy.

  18. mernst commented on May 29, 2020

    @mernst
    Contributor

    Can I annotate a return type as non-null if its supermethod returns unspecified? Can I annotate it as nullable if it already has overrides that may return unspecified?

    I'm not sure what question you are asking in "Can I".

    • If you are asking whether this is syntactically correct, then the answer is yes, because Jspecify does not forbid it.
    • If you are asking whether this causes a tool to issue a warning, that is a question that different tools may have different answers to. Jspecify cannot and must not take a position on this question.

    I guess I can't really picture how tools could choose different subtyping rules unless they were also assuming different meanings for our annotations themselves.

    Yes, different tools may treat @UnspecifiedNullness differently. I'm not sure what other annotations you are talking about when you say "our annotations", since this discussion is only about @UnspecifiedNullness.

  19. cpovirk commented on May 29, 2020

    @cpovirk
    Collaborator

    What is the benefit of Jspecify taking a stand on subtyping of @UnspecifiedNullness, but permitting tools to ignore it and/or impose their own different subtyping?

    Fair: At this point, I am throwing ideas at the wall and seeing what sticks. If I'm not being outright self-contradictory, I'm getting very close. Still, I will try to wriggle out of this :)

    In proposing that tools can ignore rules, I am mostly just acknowledging reality: I can write as many tens of thousands of words as I want, but ultimately tool owners get to decide what their tools do -- including, say, not recognizing Jspecify annotations at all, treating them like the FindBugs @Nullable, or checking only for contradictory constructions like @Nullable @NonNull. I can say that one interpretation or another is "required," but that distinction is not necessarily meaningful to end users. So I'm happy to push for weaker requirements if that makes this process less controversial.

    But it may be that a weaker spec ends up more controversial! Certainly there will be some controversy no matter what: After all, we're here because we assume that whatever "requirements" or "suggestions" we write will have some effect. Maybe I am just playing semantic games? I don't feel that I have a well-thought out position of my own for this, and I surely haven't internalized your whole position, either.

    For the purposes of our present discussions, I'd like to have some term (whether it's "subtyping" or not) that we can use. With it, we can discuss behavior that we expect some tools to find useful but that we acknowledge that not all tools will implement. I think that providing a guide to such "potentially useful behavior" is a noble goal for us, even if it's "not a spec."

    Yet, at the same time, I am poking you with question about whether @NonNull <: @NullnessUnspecified <: @Nullable is sound, presumably under the assumption that you and other tool authors might adopt it :) I do want for our "suggestions" to be palatable to tool authors. Not to mention that I want to be unsound only intentionally, rather than by accident. As much as possible, I'd like for tool authors to feel that they need only layer knowledge on top of ours: "Jspecify doesn't know that this this expression's type is a subtype of @NonNull Object, but I know that someone just performed a null check on it, so...."

  20. cpovirk commented on May 29, 2020

    @cpovirk
    Collaborator

    @mernst , I'm sorry if you've stated this before and I've forgotten it, but do you have an idea in mind of where you would draw the line between what to specify and what not to? I just linked to one thing you said, but I don't want to make assumptions about what you meant by "perhaps a few other weak properties."

    For example, in endorsing @Nullable :> @NonNull, it seems like you might consider the following test to be acceptable:

    Object foo(@Nullable Object p) {
      return p; // type mismatch
    }
    

    In terms of what to check, I'm thinking a little in terms of the Subtyping Checker here. (You would know better than I if that comparison is in any way illuminating or even fair.)

    But it may be that even that is too far: If we're not prescribing tool behavior, then what does it mean to "test" what happens when there's a mismatch?

  21. kevinb9n commented on May 29, 2020

    @kevinb9n
    CollaboratorAuthor

    Can I annotate a return type as non-null if its supermethod returns unspecified? Can I annotate it as nullable if it already has overrides that may return unspecified?

    I'm not sure what question you are asking in "Can I".

    • If you are asking whether this is syntactically correct, then the answer is yes, because Jspecify does not forbid it.

    I think it should be more than "I searched everything and couldn't find anything saying not to, so I guess I can". It should be that any person who understands the meanings of the annotations correctly will have positive knowledge that of course this scenario above is okay. I brought the word "subtyping" into all this as a way to provide that positive knowledge. When a person knows that a subtyping relationship exists then they can relax in the knowledge that everything true of the parent is true of the child.

    I do get the sense though that you and I are often arguing about something different from what we really seem to be arguing about, but I can't always put my finger on what our real disagreement is.

    • If you are asking whether this causes a tool to issue a warning, that is a question that different tools may have different answers to. Jspecify cannot and must not take a position on this question.

    I hope I can explain this right. I've tried a number of times.

    I really and truly don't care what specific warnings tools choose to emit.

    I really and truly do want our annotations to have clear and precise meanings. The result of that is that certain combinations of annotations will be outright logical contradictions. I want our specs to be clear on those combinations being invalid. I don't care what a tool does or doesn't decide to do about it.

    I am concerned about tools deciding that one of our annotations carries some meaning that is more and/or less than what we specified, and acting accordingly to that interpretation. Not that I have any illusions that we can prevent it, but I think it is decidedly a bad outcome, and if our decisions pushed the tool owner to that route then we would have to accept some of the blame. The poster child for this is of course @NullnessUnspecified, because it represents the absolute lack of any information about the intended nullness of the type. If a tool interprets that annotation as, "we think what they're really trying to say is...", well, again, I just think that's a bad outcome.

    Yes, different tools may treat @UnspecifiedNullness differently. I'm not sure what other annotations you are talking about when you say "our annotations", since this discussion is only about @UnspecifiedNullness.

    And I think this glosses over the distinction I've been struggling to make (perhaps because it is just too subtle for its own good). The outcome I hope for is that any two tools are going to agree that the annotations mean the same thing (convey the same information about the API owner's intentions), they may just want to take different actions based on the same information. I can't tell if you understand it the same way and just keep seeing us as trying to dictate the actions, or if this is really what you're objecting to itself.

  22. kevinb9n commented on May 29, 2020

    @kevinb9n
    CollaboratorAuthor

    (A lot of this is the issue that #73 was initially created to discuss, though who knows in what directions the discussion has gone since :-))

  23. kevin1e100 commented on May 30, 2020

    @kevin1e100
    Collaborator

    Two questions, @mernst:

    1. What's the value of not specifying a (partial or total) ordering of the three qualifiers? I guess what I'm asking is, can you give some examples of what only specifying "non-null < nullable", and saying nothing about how "unspecified" relates, would allow tools to do that specifying "non-null <= unspecified <= nullable" would prevent?

    2. If we define "unspecified" as "it may be non-null or it may be nullable, we don't know", it appears:

      • non-null implies nullable
      • non-null implies unspecified
      • unspecified implies nullable
        Seemingly these implications hold regardless of whether we prescribe them, just following the definition. Even if we define unspecified := \exists x. (x = non-null or nullable), that is, even if we defined "unspecified" as derived from other qualifiers, these implications seem to hold. If that's the case then it seems "harmless" to codify something that appears true anyways. What am I missing?

    That said I agree that defining subtyping or assignability could be overreaching, not least since assignments happen in code, which we consider out of scope. There's however one area where we seemingly should say something, and that is the area of what constitutes valid overriding. That is, it seems to me it would be useful to introduce some lowest common denominator where all tools are required to consider some declarations class C extends B implements Foo, Bar, ... { ... } as "well formed" so they can interpret them consistently (and I'm talking about declarations only here, not method implementation code). For instance, consider:

    // no annotations
    interface ListLike<T> {
      T get(int index);
      boolean contains(Object elem);
    }
    // annotated
    class MyList implements ListLike<@NonNull String> {
      @Override T get(int index) {...}
      @Override boolean contains(@Nullable Object elem) {...}
    }
    

    Given ListLike, it seems helpful to prescribe whether MyList should be considered a well-formed declaration, that defines a class that implements ListLike<@NonNull String>, with methods that indeed override ListLike<@NonNull String>'s methods. If we don't do that, but the author of MyList happens to use a tool that accepted MyList, a second tool might reject MyList or might refuse to process code that depends on MyList or even refuse to read in MyList's bytecode. We can argue over exactly what that bar should be, and whether it should apply only to bytecode or also source code, but it seems useful to define some bar. And because most code today is unannotated, it seems important for that bar to include some rules for handling unspecified nullness.

    It seems we may get away with simply saying something like, "it's always allowed to use @UnspecifiedNullness (implicitly in unannotated code, or explicitly) where a supertype used @NonNull or @Nullable, and vice versa", which doesn't require an ordering of unspecified vs. other qualifiers. We could still specify co-, contra-, and in-variant handling of @NonNull vs @Nullable as appropriate, just not for @UnspecifiedNullness. We can certainly allow tools to raise warnings when seeing changes to or from @UnspecifiedNullness in source code, maybe even in bytecode, but it does seem useful to define "enough" for tools to still interpret MyList consistently, even if some of them raise warnings on MyList's declaration, so that references to MyList in other code can be handled. I believe this level of specification would be consistent with not including "unspecified" in any kind of ordering as you requested. Is that what you had in mind?

    I personally would like to take one or more of the following steps (still talking only about declarations and overriding here, not code, and specifically overriding that changes @UnspecifiedNullness to one of the other 2 qualifiers), in order of preference:

    1. some form of @SuppressWarnings-like annotation should suppress warnings related to overriding that changes qualifiers to and from @UnspecifiedNullness in the annotated scope. This would make it so users have a way to make any tool accept the overriding they want.
    2. if we draw a distinction between warnings, where tools print something but continue, and errors, where tools stop, tools should never "error" when they see these situations in bytecode (e.g., tools would be required to accept MyList's bytecode: they can print warnings but should continue on).
    3. changes to and from @UnspecifiedNullness that are consistent with the proposed qualifier ordering (non-null <= unspecified <= nullable) and allowed per co- or contra-variance rules shouldn't cause warnings, or at least shouldn't cause errors (because they are seemingly "safe" as discussed above).

    Now only the last one requires defining some kind of ordering of all 3 qualifiers. I do think it's a useful rule that would make interop between different tools more seamless. But I guess in all of this I've talked myself into thinking that we can get pretty far even without defining this ordering. Thoughts?

  24. kevin1e100 commented on May 30, 2020

    @kevin1e100
    Collaborator

    One other thing to note is that not ordering "unspecified" seemingly has both perils and advantages in this weird case, which I implicitly referenced in ListLike<T> in my last post:

    interface Foo<T extends @NullnessUnspecified Object>
    

    It's always been a bit vexing what this is supposed to mean.

    • by not relating "unspecified" to other qualifiers, we're somewhat side-stepping that question, and in particular that would allow tools to raise warnings on Foo<@NonNull String>, which multiple folks have considered desirable.
    • by stating that non-null <= unspecified we're apparently saying that Foo<@NonNull String> should be considered valid, which I personally think is fine, but it's then seemingly inconsistent that Foo<@Nullable String> can cause warnings.
  25. kevinb9n commented on May 30, 2020

    @kevinb9n
    CollaboratorAuthor

    Two questions, @mernst:

     Seemingly these implications hold regardless of whether we prescribe them, just following the definition.
    

    Yes, thank you for that clarity, this is my view too.

    That said I agree that defining subtyping or assignability could be overreaching, not least since assignments happen in code, which we consider out of scope.

    Just to renew my objection to this: a conscientious API owner decides what type a parameter should have based on what kinds of actual parameter expressions should be assignable to it.

    I think "APIs, not implementation code" has been a slight oversimplification, and we might as well just use this better oversimplification instead:

    • APIs: in scope
    • Implementation code that is directly interacting with an API: in scope
    • Other implementation code, out of scope

    I personally would like to take one or more of the following steps (still talking only about declarations and overriding here, not code, and specifically overriding that changes @UnspecifiedNullness to one of the other 2 qualifiers), in order of preference:

    1. some form of @SuppressWarnings-like annotation should suppress warnings related to overriding that changes qualifiers to and from @UnspecifiedNullness in the annotated scope. This would make it so users have a way to make any tool accept the overriding they want.

    (aside: This should be @SuppressWarnings itself, since one of the reasons the qualifier is getting overridden to unspec may be that the library is not taking on our dependency yet.)

    1. if we draw a distinction between warnings, where tools print something but continue, and errors, where tools stop, tools should never "error" when they see these situations in bytecode (e.g., tools would be required to accept MyList's bytecode: they can print warnings but should continue on).

    To head off Mike's probable objection :-), we don't need to take stances on what tools print.

    Once we provide precise enough meanings for our annotations, then we can point out various situations that are categorically invalid ("error") as direct consequences of those meanings, and situations that are less than provably safe ("warning") as well. And we should. We certainly mustn't avoid doing so out of fear that it could sound like dictating tool behavior.

    But I guess in all of this I've talked myself into thinking that we can get pretty far even without defining this ordering. Thoughts?

    I'm still in sync with your opener: that the ordering is nothing but a logical consequence of the definitions. One reaction to that is "so we don't need to specify it", but mine is "so it would be silly of us to pretend that we're not specifying it." We are, just by consequence rather than fiat.

  26. kevinb9n commented on May 30, 2020

    @kevinb9n
    CollaboratorAuthor

    Btw, the more repeatedly and strenuously I assert a position, the more I welcome comments that "here are some consequences of that position you might not be accounting for." That, in my view, is how this all works. Until this thing is done, the design principles I hope for are purely aspirational, and some of them won't survive.

  27. cpovirk commented on Jun 2, 2020

    @cpovirk
    Collaborator

    Sorry for dragging this off in the direction of #73.

    How would people feel about starting another GitHub issue to continue this discussion -- but with the explicit expectation that the discussion may go in various directions? We could set expectations with a name like "June 2020 chat on tool freedom and unspecified nullness," and we could close it when the discussion peters out.

    That would take off some of the pressure to stay exactly on one predefined topic -- though of course that pressure is often a good thing! -- and to produce the organized, digestible issue that we might ideally like.

    We could view it more like an email thread, only one that has nice Markdown support and easy cross-linking to specific posts. Or we could just use email (or docs) if that's what people prefer. I'm just going off the assumption that we have ended up on the issue for one reason or another. We're going to have meandering discussions sometimes, if only until we zero in one the source of our differences in each, so we can experiment with the forum that works best for us.

  28. kevinb9n commented on Aug 18, 2021

    @kevinb9n
    CollaboratorAuthor

    I'm convicting this issue of the crime of being extremely long and outdated. Anyone may file a new issue for any particular aspect touched on here that feels in need of resolution.

  29. added
    design
    on Mar 13, 2024
  30. added this to the 0.3 milestone on Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    designnullness

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions