data class Type1(val str: String) data class Type2(val str: String) interface Person data class Child1(val name: Type1) : Person data class Child2(val name: T
Assume that we have some class that has an important generic variable T and another class we have two fields, one wrapped, and one not: class Wrapper<V> {
First time I've run into this issue so apologies if the title doesn't make sense, couldn't figure out a good way to word it. I'm working with an API that return
When typescript captures generics it captures them very specifically which can lead to complications. How can I make this "LessSpecific" type dynamically return
Is it possible to merge the props of two generic object types? I have a function similar to this: function foo<A extends object, B extends object>(a: A,
I have the following class: export class BufferData { arr: Float32Array; index: number; constructor() { this.arr = new Float32Array(8); this.inde
public class ArrayPQK<P extends Comparable<P>, T> implements PQK<P, T> { int maxsize; int size; int head,tail; Pair<P, T>[] nodes; publi
The generics proposal has a section on how to return the zero value of a type parameter, but it does not mention how to check if a value of a parametrized type
I'm trying out go generics in 1.18beta2 and I'm trying to write an abstraction layer for key/value store, boltdb. This is what I'm trying to achieve with it. ty
package main import ( "google.golang.org/protobuf/proto" ) type NetMessage struct { Data []byte } type Route struct { } type AbstractParse interface
I have an interface in go which wants to support saving and loading results in different databases and I want to support different types. package cfgStorage ty
Is there something like Show (deriving Show) that only uses an algebraic datatype's constructors? (please don't mind that I'm using the word constructor, I don'
In plain C, pointers to void are useful as arguments to generic functions, such as a generic quicksort, or a generic swap, etc., as seen here: Implementation of
I am trying to implement this helper function in C# 7.3: public static T? ToEnum<T>(this string enumName) where T : Enum =>
I am trying create a typescript class MyClass with instance properties set dynamically in the constructor: const myInstance = new MyClass(({ someField: 'foo'
I noticed there wasn't an easy all-inclusive (POJO-free) way to convert (in GSON) a JsonArray to a List. I found an example that uses a TypeToken and when I tri
Just started learning generics. I'm making a command processor and I honestly don't know how to word this so I'm just going to show an example problem: var ErrI
Question: Is there a way to write one function that would account for the different data types? Would generics work and if so how do you do that in AnyLogic? Ba
I have generated a minheap to this file but I think something I have missed but I can't identify what are the things I have missed. I have missed something on
Assume we are given a generic class definition such as: from dataclasses import dataclass from typing import TypeVar, Generic, List T1 = TypeVar('T1') T2 = Ty