20,098 questions
Score of -1
2 answers
209 views
How can I make developers override one of the two methods of an interface?
I'm making a library in Kotlin, but with Java-Kotlin interoperability. The interface I have has a method that takes a lambda function. It is overloaded with one getting Kotlin's lambda and one ...
Score of 1
1 answer
86 views
Kotlin Type Erasure irreversible?
Let's say we have a functional interface for processing annotations (AnnotationProcessor) that takes the annotation class it will work with as a parameter. We then define three of these processors; I'...
Score of 2
1 answer
102 views
cmake interface library file set visibility
I have a question on visibility of file sets for interface libraries. If I have an interface library and it has a headers file set with interface visibility, it's clear what a consumer of the library ...
Score of 12
1 answer
443 views
Do sealed interfaces in Java enable any specific JVM optimisations, or are they purely a compile‑time exhaustiveness feature
I understand that sealed interfaces (and sealed classes) allow the compiler to perform exhaustive checks for pattern matching and switch expressions, which is a clear improvement in type safety at ...
Best practices
0
votes
2
replies
58
views
Constructor config vs explicit method parameters for strategy interface: which is better for an order processor API?
I’m designing an API for order batching and would like opinions on one specific design choice.
Context:
An API request gives me only a tenant_id
From tenant_id, I load warehouse_layout
From ...
Advice
1
vote
7
replies
177
views
How can a class that implements an interface return another interface in a method?
I am sorry for asking this, but I am very confused. I am creating a project where I compare various sorting methods (such as Selection Sort, Bubble Sort, and Merge Sort). It asks me to create two ...
Advice
2
votes
9
replies
184
views
Trouble Understanding Interfaces
I am learning about interfaces in java. I am confused as to what they are and how to implement them in my code. am I supposed to write the implementation in the .java file for the class I want to ...
Score of 1
0 answers
147 views
Inconsistency between abstract method and interface method return type checking (CS0738) [duplicate]
Let's say I have this C# code. Why is it OK that I return a string from ClassA.DoThing(), but I cannot return a string from ClassB.DoThing()?
public abstract class MyBase
{
public abstract object ...
Advice
0
votes
21
replies
361
views
What is an Interface in Java?
i am currently lost.
I am learning Java at school and we have a Project in which a group needs to explain a certain thing in Java. Mine is Interfaces.
I am trying to research on what exactly ...
Best practices
0
votes
3
replies
48
views
Interfacing different Rust Po3 libraries
I am working on a project. It runs mostly on python because it involves communicating with NIVIDIA inference system and other libraries that are mature in python. However when it comes to perform my ...
Best practices
0
votes
1
replies
48
views
Using Julia's multiple dispatch as an interface vs as a lookup table for extensible library code
In Java, there is the concept of an Interface, which groups several method signatures together without any implementations. This interface can then be 'implemented' on a class to specify that that ...
Score of 2
1 answer
112 views
Generic interface with default implementations
I have this interface:
public interface IDebugEndPoint
{
void InstructionReady(ICPU cpu);
}
where ICPU is implemented by many concrete CPU types. I pass an IDebugEndPoint to an ICPU for "...
Score of 2
1 answer
100 views
Instantiation of type with recursive type constraints
The Announcing F #7 page gives the example code
type IAddition<'T when 'T :> IAddition<'T>> =
static abstract op_Addition: 'T * 'T -> 'T
type Number<'T when IAddition<'T&...
Advice
1
vote
0
replies
64
views
How do I create APIs for training ML models to play games? (Reference request)
I'm interested in learning how to train machine learning models to play video games. I would love to see general references (books and papers) on how to do this; I see lots of papers on the model ...
Best practices
1
vote
4
replies
179
views
What are the strengths and weaknesses of using VTable/COM-centric APIs?
I'm currently designing a library,
I want this library to maintain a stable interface for old applications,
However, it should be expandable.
It acts as a hardware abstraction layer.
The graphics ...