Questions tagged [subtype]
198 questions
6
votes
4 answers
c# Concrete override of generic class
Here's the generic class I'm working with:
public interface IRepository where T : EntityObject
{
RepositoryInstructionResult Add(T item);
RepositoryInstructionResult Update(T item);
RepositoryInstructionResult Delete(T…
![](../../users/profiles/590355.webp)
daveharnett
- 310
- 2
- 12
6
votes
2 answers
Scala types: least upper bounds
I am trying to parameterize some methods with very general type parameters.
As an example, in the REPL I first define:
trait Term
case class FunctionalTerm[+T <: Term](t: T) extends Term
Intuitively, the following method takes a Term and a…
![](../../users/profiles/1399246.webp)
Andrew Bate
- 396
- 2
- 14
6
votes
1 answer
How to create custom project that inherits from c# using MPF?
Using Visual Studio's Managed Package Framework, how can I inherit from C# so I can have C# property pages and C# project items? I've tried making a flavored project, but it was limited in terms of making our own custom nodes and custom file…
![](../../users/profiles/126536.webp)
Paul Reisert
- 81
- 6
5
votes
3 answers
What is the difference between "Java subtype" and "true subtype"
I've just now encountered the phrases "java subtype" and "true subtype". It was given in a question in a way that makes clear that they are not the same. But I couldn't find an explanation on what is the difference between the two.
Can someone…
![](../../users/profiles/480692.webp)
SIMEL
- 8,246
- 23
- 76
- 115
5
votes
5 answers
Subtyping database tables
I hear a lot about subtyping tables when designing a database, and I'm fully aware of the theory behind them. However, I have never actually seen table subtyping in action. How can you create subtypes of tables? I am using MS Access, and I'm looking…
![](../../users/profiles/14902.webp)
Smashery
- 49,979
- 30
- 90
- 123
5
votes
2 answers
Java: compile-time resolution and "most specific method"
The overloaded functions compute1(), compute2(), and compute5() cause compilation errors if you try to use them below:
package com.example.test.reflect;
class JLS15Test2
{
int compute1(Object o1, Integer i, Integer j) { return 1; }
…
![](../../users/profiles/44330.webp)
Jason S
- 171,795
- 155
- 551
- 900
5
votes
0 answers
Dart Generics - type is not a subtype
I'm getting a runtime error from a Dart generic function:
Widget card = widget.cardBuilder(item);
Which generates:
type '(Contact) => Widget' is not a subtype of type '(DeletableItem) => Widget'
The Contact class is defined as
class…
![](../../users/profiles/8994998.webp)
Brett Sutton
- 1,429
- 7
- 20
5
votes
3 answers
Relational data modeling for sub types
I am learning the Relational Model and data modeling.
And I have some confusion in my mind regarding sub types.
I know that data modeling is an iterative process and there are many different ways to model things.
But I don't know how to choose…
![](../../users/profiles/4826671.webp)
dzhu
- 643
- 8
- 17
5
votes
1 answer
Existential types for F-Bounded Polymorphic types and non-generic subtypes?
I have two subtypes that I need to be F-bounded polymorphic by a type A, and a subtype of one of those subtypes, i.e.
trait A[T <: A[T]] {
def x: T
}
trait Ter extends A[Ter]
trait For extends A[For]
trait C extends Ter
Next I try to implement a…
![](../../users/profiles/1586965.webp)
samthebest
- 28,224
- 21
- 93
- 129
4
votes
2 answers
Restrict class to trait and structural subtype in Scala
I need to restrict a Scala method parameter so that it implements both a trait and a structural subtype. How can I do this?
trait Foo
// ...
def someMethod[A <: Foo xxx { def close() }](resource: A)(block: A => Unit) {
// ...
}
What do I put in…
![](../../users/profiles/96233.webp)
Ralph
- 29,142
- 31
- 124
- 261
4
votes
2 answers
Sub-typing on Primitive types in Java
I have this statement in my university classes' notes on sub-typing relations:
T is a subtype of S if code written for variables of type S can also be safely used on variables of type T
Section 4.10.1 of the Java Language Spec, describes the…
![](../../users/profiles/10966389.webp)
TF.Ryan
- 43
- 1
- 3
4
votes
1 answer
Check if a type DIRECTLY derives from (is a child of) another type in an "enable if" context
C++ has is_base_of . However, this also includes “grandparent” types.
Is there a way to get have is_child_of functionality? The purpose is to use types as sentinel 'interface' markers in an SFINAE context, without being…
![](../../users/profiles/2864740.webp)
user2864740
- 54,112
- 10
- 112
- 187
4
votes
3 answers
Is a Path Dependent Type a subtype?
trait A {
trait B {
def foo: A.this.B = new B{}
def bar: A#B = foo
def baz: A.this.B = bar // type mismatch; found : A#B required: A.this.B
}
}
Am I right that A.this.B is a path dependent type?! (That's my understanding so…
![](../../users/profiles/562716.webp)
Peter Schmitz
- 5,734
- 4
- 24
- 48
4
votes
2 answers
MD5 in Oracle (DBMS_OBFUSCATION_TOOLKIT.MD5)
I'm trying to compose a function to obtain MD5 hashes from bits I've gathered here and there. I want to obtain the lower-case hexadecimal representation of the hash. I have this so far:
CREATE OR REPLACE FUNCTION MD5 (
CADENA IN VARCHAR2
)…
![](../../users/profiles/13508.webp)
Álvaro González
- 128,942
- 37
- 233
- 325
4
votes
0 answers
Coq: Defining a subtype
I have a type, say
Inductive Tt := a | b | c.
What's the easiest and/or best way to define a subtype of it? Suppose I want the subtype to contain only constructors a and b. A way would be to parametrize on a two-element type, e.g. bool:
Definition…
![](../../users/profiles/4967226.webp)
jaam
- 802
- 4
- 18