Skip to main content

Questions tagged [subtypes]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
2 answers

What are the problems of subtyping?

I've heard often that Subtyping breaks some important and useful properties: many nice innovations developed by pure programming language researchers can't be brought to Java or C++ because of ...
Helloer's user avatar
  • 273
2 votes
4 answers

How to relate summary to detail data objects?

My application I have two types of customers: individuals and business customers. My users sometimes need to be able to see the full details of one customer, but at other times they only need to see ...
workerjoe's user avatar
  • 261
0 votes
1 answer

Implicit conversion for function subtyping

Languages with coercions (i.e. implicit type conversions) allows expressing things like that (irrespective of any syntax): f : int32 → int32 = λx.x+x a : int16 = 42 b : int64 = f(a) Where type ...
cuihtlauac's user avatar
15 votes
4 answers

How to handle the methods that have been added for subtypes in the context of polymorphism?

When you use the concept of polymorphism you create a class hierarchy and using parents reference you call the interface functions without knowing which specific type has the object. This is great. ...
Narek's user avatar
  • 1,143
7 votes
2 answers

Are lower-arity functions subtypes of higher-arity ones?

I've found that there isn't a concept similar to "arity-based subtyping" in many languages that I've programmed in, where higher-order functions could consume functions of lower arity than their ...
concat's user avatar
  • 517
8 votes
3 answers

How are typeclasses in functional languages different from interfaces in OO languages?

I'm learning about paradigms of functional languages. So I've read that while Subtype polymorphism is typical for OO languages, Parametric polymorphism is typical for functional languages. But I ...
hgiesel's user avatar
  • 811
13 votes
2 answers

Why is behavorial subtyping undecidable?

Liskov's work in this area focused on behavioral subtyping, which besides the type system safety discussed in this article also requires that subtypes preserve all invariants guaranteed by the ...
q126y's user avatar
  • 1,713
6 votes
2 answers

Why is it bad to have one mechanism for inheritance and subtyping?

It is quite well-known that (class) inheritance and subtyping (sometimes called interface inheritance) are different things: inheritance is a mechanism for sharing code, while subtyping is a ...
bwcoder's user avatar
  • 71
7 votes
4 answers

Heterogeneous Associations - Data Modeling When an Object that Must Relate to One of Many Classes

Suppose you have 3 classes: ClassA, ClassB and ClassC. Now suppose you have a class Message. You want a one-to-many relationship between each one of those three classes and the Message. The goal is ...
user1987392's user avatar