Timeline for How should we clean up [type-annotation]?
Current License: CC BY-SA 4.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 18 at 22:11 | answer | added | InSync | timeline score: 1 | |
Sep 5, 2022 at 6:53 | comment | added | dan1st | Note that [annotations] and [java-annotations] exist as well. | |
Sep 2, 2022 at 12:14 | comment | added | Braiam | How this tag makes more easy to answer these questions in a way that the title/body can't do it? | |
Sep 2, 2022 at 0:22 | answer | added | Silvio Mayolo | timeline score: -3 | |
Sep 1, 2022 at 22:27 | comment | added | Jörg W Mittag | There are essentially two problems here: 1) the Java community chose an extremely confusing name for this feature by naming it something that already has a well-defined meaning and 2) this tag makes the same mistake, by using the generic term to apply only to the niche usage. | |
Sep 1, 2022 at 22:24 | comment | added | Jörg W Mittag |
@KarlKnechtel: No, the term is used completely differently in Java. Java has a feature called Annotations which allow you to add metadata to methods, interfaces, classes, and enums. Crucially, for a very long time, Java did not allow you to annotate types. E.g. you could not write something like class Option<@NotNull T> . That is what the type annotations feature in Java added: these are annotations for types, not annotating something with a type.
|
|
Sep 1, 2022 at 12:47 | history | became hot meta post | |||
Sep 1, 2022 at 11:02 | comment | added | Gimby | "AFAIK these annotations are used for additional metadata, not type hints" - I would agree there. The type hinting is done through generics. Type annotations provide additional meta data about said type. I.E. "cannot be null" or "cannot exceed 100 characters". I kind of find it confusing to call them so specifically type annotations; they're just annotations in the end. | |
Sep 1, 2022 at 9:57 | history | edited | SuperStormer | CC BY-SA 4.0 |
deleted 1 character in body
|
Sep 1, 2022 at 4:49 | comment | added | Karl Knechtel |
Are Java's type annotations somehow fundamentally different? Are type annotations not just a form of type hinting? (I can think of two reasons to use a type annotation: because a human will read it, or because a compiler or other tool will parse it; in either case, it seems fair to me to say that a type is being "hinted" to the reader or the parser respectively.) What's wrong with tagging the Java questions about this feature as [java] [type-hinting] , and the Python questions as [python] [type-hinting] ?
|
|
Aug 31, 2022 at 22:09 | comment | added | 0Valt | I'd say that maybe we should just consider making [type-hinting] a synonym of [type-annotations], @MartijnPieters? Granted, they aren't called the same, but they are similar enough in principle (as we both mentioned), so there doesn't seem to be any harm in synonymizing. | |
Aug 31, 2022 at 21:45 | comment | added | Martijn Pieters Mod | Python type hinting is built on top of its annotations syntax. "type annotations" is an entirely correct term for these annotations. So it's not all that surprising the tag has been co-opted by the Python community. | |
Aug 31, 2022 at 21:41 | comment | added | 0Valt | SME here - TypeScript has type annotations (technical term). I suggest we just update the tag wiki to make the tag generic, the concept is common enough for multiple languages. Although it won't hurt to retag Python's questions to [type-hinting] while we are at it as those ain't, strictly speaking, type annotations. They are close enough, on the other hand, to just consider synonymizing. | |
Aug 31, 2022 at 21:34 | history | asked | SuperStormer | CC BY-SA 4.0 |