# \#interface

**URL:** https://discourse.julialang.org/tag/interface/413.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Libjulia: is it really necessary to wrap immutable variables to protect them and why?](https://discourse.julialang.org/t/libjulia-is-it-really-necessary-to-wrap-immutable-variables-to-protect-them-and-why/135441)

<div class="topic-metadata">

**Author:** [@gvanuxem](https://discourse.julialang.org/u/gvanuxem)\
**Replies:** 1\
**Last updated:** [February 4, 2026, 9:08pm UTC](https://discourse.julialang.org/t/libjulia-is-it-really-necessary-to-wrap-immutable-variables-to-protect-them-and-why/135441 "2026-02-04T21:08:30Z")

</div>

Hello here, I have a C wrapper that calls Julia functions using libjulia and wraps the result in an IdDict, for example: int64\_t jl\_setindex\_wrap\_eval\_string(int64\_t index, const char\* code) { if (index == 0){ …

---

## [Help - not so zero-cost abstraction](https://discourse.julialang.org/t/help-not-so-zero-cost-abstraction/134435)

<div class="topic-metadata">

**Author:** [@anicusan](https://discourse.julialang.org/u/anicusan)\
**Replies:** 11\
**Last updated:** [December 10, 2025, 7:30pm UTC](https://discourse.julialang.org/t/help-not-so-zero-cost-abstraction/134435 "2025-12-10T19:30:18Z")

</div>

My problem is about an interface, and how to get the compiler to optimise it away. Say I have a Matrix with 6 rows and N columns - rows 1-3 represent position and rows 4-6 are velocity; each column is a body in a simula…

---

## [Make custom type behave like Float64](https://discourse.julialang.org/t/make-custom-type-behave-like-float64/132926)

<div class="topic-metadata">

**Author:** [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Replies:** 4\
**Last updated:** [October 7, 2025, 2:12pm UTC](https://discourse.julialang.org/t/make-custom-type-behave-like-float64/132926 "2025-10-07T14:12:31Z")

</div>

(Related to Packages for colored REPL output?.) If I make a function return a custom type so that I can create a formatted show method for it, what functions do I then need to extend to make my type behave like Float64 …

---

## [Is there an abstract interface for parameter/function estimation?](https://discourse.julialang.org/t/is-there-an-abstract-interface-for-parameter-function-estimation/132407)

<div class="topic-metadata">

**Author:** [@johtok](https://discourse.julialang.org/u/johtok)\
**Replies:** 2\
**Last updated:** [September 15, 2025, 9:41pm UTC](https://discourse.julialang.org/t/is-there-an-abstract-interface-for-parameter-function-estimation/132407 "2025-09-15T21:41:06Z")

</div>

Hi everyone. Like how “AbstractDifferentiation.jl” serves as a common interface for differentiation and enables quick testing of different backends, does anything similar exist for estimation of parameters/functions in U…

---

## [Hidden version of searchsortedfirst](https://discourse.julialang.org/t/hidden-version-of-searchsortedfirst/131776)

<div class="topic-metadata">

**Author:** [@alan](https://discourse.julialang.org/u/alan)\
**Replies:** 4\
**Last updated:** [August 23, 2025, 9:05pm UTC](https://discourse.julialang.org/t/hidden-version-of-searchsortedfirst/131776 "2025-08-23T21:05:09Z")

</div>

In the Julia source code, there is an undocumented version of searchsortedfirst: function searchsortedfirst(v::AbstractVector, x, lo::T, hi::T, o::Ordering)::keytype(v) where T\<:Integer I need a function like this, in …

---

## [\[ANN\] MultipleInterfaces.jl: Interfaces with multiple inheritance and multiple dispatch](https://discourse.julialang.org/t/ann-multipleinterfaces-jl-interfaces-with-multiple-inheritance-and-multiple-dispatch/130796)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 28\
**Last updated:** [August 8, 2025, 12:39am UTC](https://discourse.julialang.org/t/ann-multipleinterfaces-jl-interfaces-with-multiple-inheritance-and-multiple-dispatch/130796 "2025-08-08T00:39:15Z")

</div>

I’m pleased to announce the release of MultipleInterfaces.jl. MultipleInterfaces.jl provides a powerful way to define and work with interfaces in Julia. With MultipleInterfaces.jl you can declare an interface that is def…

---

## [ANN: TraitInterfaces.jl - explicit interfaces in Julia](https://discourse.julialang.org/t/ann-traitinterfaces-jl-explicit-interfaces-in-julia/131151)

<div class="topic-metadata">

**Author:** [@kris-brown](https://discourse.julialang.org/u/kris-brown)\
**Replies:** 0\
**Last updated:** [July 28, 2025, 11:01pm UTC](https://discourse.julialang.org/t/ann-traitinterfaces-jl-explicit-interfaces-in-julia/131151 "2025-07-28T23:01:53Z")

</div>

Hi, I’m pleased to share TraitInterfaces.jl. It provides an @interface macro to declare interfaces and an @instance macro to declare implementations of those interfaces. These implementations are identified with Julia va…

---

## [Common API for \`Integrate\`. IntegrationBase](https://discourse.julialang.org/t/common-api-for-integrate-integrationbase/130637)

<div class="topic-metadata">

**Author:** [@misha\_mikhasenko](https://discourse.julialang.org/u/misha_mikhasenko)\
**Replies:** 5\
**Last updated:** [July 11, 2025, 6:30pm UTC](https://discourse.julialang.org/t/common-api-for-integrate-integrationbase/130637 "2025-07-11T18:30:02Z")

</div>

I’ve observed a conflict of different packages exporting integrate (e.g.). It would be nice to have IntegrationBase with API. Currently, the ecosystem is diverse. Overview of methods integrate is exported by Polynomi…

---

## [How can interfaces work with symbolic-diff?](https://discourse.julialang.org/t/how-can-interfaces-work-with-symbolic-diff/129565)

<div class="topic-metadata">

**Author:** [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Replies:** 8\
**Last updated:** [June 3, 2025, 9:01am UTC](https://discourse.julialang.org/t/how-can-interfaces-work-with-symbolic-diff/129565 "2025-06-03T09:01:18Z")

</div>

In @MilesCranmer’s post about abstract typing, @ChrisRackauckas wrote I didn’t want to take that thread off topic, so pulling this out. I’m interested to see @ChrisRackauckas mention function interfaces as a solution w…

---

## [Interfaces/traits in julia 2.0 and multiple inheritance](https://discourse.julialang.org/t/interfaces-traits-in-julia-2-0-and-multiple-inheritance/124011)

<div class="topic-metadata">

**Author:** [@serhii](https://discourse.julialang.org/u/serhii)\
**Replies:** 37\
**Last updated:** [May 7, 2025, 5:53pm UTC](https://discourse.julialang.org/t/interfaces-traits-in-julia-2-0-and-multiple-inheritance/124011 "2025-05-07T17:53:09Z")

</div>

Recently, I started programming in Rust, and like many others, I noticed how powerful the design language and solutions around traits can be. This prompted me to investigate Julia’s interface and trait-related packages: …

---

## [Avoid copy when using data for Ptr{T}](https://discourse.julialang.org/t/avoid-copy-when-using-data-for-ptr-t/128602)

<div class="topic-metadata">

**Author:** [@aitzkora](https://discourse.julialang.org/u/aitzkora)\
**Replies:** 4\
**Last updated:** [May 2, 2025, 7:26pm UTC](https://discourse.julialang.org/t/avoid-copy-when-using-data-for-ptr-t/128602 "2025-05-02T19:26:25Z")

</div>

Hi, I call a fortran code which calls Julia trough a @cfunction using pointers (Ptr{T}), and I want to avoid copying data from Fortran in Julia such as in the following code using Libdl:dlopen, dlsym using Test funct…

---

## [Zig Like Interfaces for Julia](https://discourse.julialang.org/t/zig-like-interfaces-for-julia/125085)

<div class="topic-metadata">

**Author:** [@cshen](https://discourse.julialang.org/u/cshen)\
**Replies:** 3\
**Last updated:** [February 3, 2025, 10:26pm UTC](https://discourse.julialang.org/t/zig-like-interfaces-for-julia/125085 "2025-02-03T22:26:24Z")

</div>

I’ve recently come across how Zig handles interfaces. The gist is that Zig doesn’t have syntax sugar for interfaces and instead opts for manually managing the vtable. I got curious and started playing with the idea, and…

---

## [Interfaces.jl unable to find implementation](https://discourse.julialang.org/t/interfaces-jl-unable-to-find-implementation/124299)

<div class="topic-metadata">

**Author:** [@langestefan](https://discourse.julialang.org/u/langestefan)\
**Replies:** 2\
**Last updated:** [December 31, 2024, 11:52am UTC](https://discourse.julialang.org/t/interfaces-jl-unable-to-find-implementation/124299 "2024-12-31T11:52:50Z")

</div>

Hi. I am trying to implement Interfaces.jl for my package. The code can be found here: SolarPosition.jl/src at main · PVSMC/SolarPosition.jl · GitHub The interface definition is here: SolarPosition.jl/src/PositionInte…

---

## [Why did Julia choose nominal typing over structural typing/traits?](https://discourse.julialang.org/t/why-did-julia-choose-nominal-typing-over-structural-typing-traits/122517)

<div class="topic-metadata">

**Author:** [@serhii](https://discourse.julialang.org/u/serhii)\
**Replies:** 29\
**Last updated:** [November 16, 2024, 3:12pm UTC](https://discourse.julialang.org/t/why-did-julia-choose-nominal-typing-over-structural-typing-traits/122517 "2024-11-16T15:12:40Z")

</div>

I’ve been thinking about Julia’s type system design, particularly how it uses nominal typing rather than structural typing or a trait-based system. I’m curious about the historical and technical reasons behind this choic…

---

## [What interface to implement for \`round(x, digits=n)\` to work?](https://discourse.julialang.org/t/what-interface-to-implement-for-round-x-digits-n-to-work/122372)

<div class="topic-metadata">

**Author:** [@barucden](https://discourse.julialang.org/u/barucden)\
**Replies:** 2\
**Last updated:** [November 7, 2024, 9:32am UTC](https://discourse.julialang.org/t/what-interface-to-implement-for-round-x-digits-n-to-work/122372 "2024-11-07T09:32:38Z")

</div>

There is a section in the documentation that explains what methods to implement to support rounding on a new type: Apparently, one needs to implement round(x::ObjType, r::RoundingMode). The section even includes an exa…

---

## [Non-intuitive difference of copyto! between CuArray and Array](https://discourse.julialang.org/t/non-intuitive-difference-of-copyto-between-cuarray-and-array/119904)

<div class="topic-metadata">

**Author:** [@0samuraiE](https://discourse.julialang.org/u/0samuraiE)\
**Replies:** 3\
**Last updated:** [September 26, 2024, 2:43pm UTC](https://discourse.julialang.org/t/non-intuitive-difference-of-copyto-between-cuarray-and-array/119904 "2024-09-26T14:43:01Z")

</div>

Hi all. I trapped an error when using copyto! to CuArray. Error is ERROR: CUDA error: invalid argument (code 1, ERROR\_INVALID\_VALUE) Stacktrace: \[1\] throw\_api\_error(res::CUDA.cudaError\_enum) @ CUDA ~/.julia/packa…

---

## [Problem making two custom number types work together](https://discourse.julialang.org/t/problem-making-two-custom-number-types-work-together/117735)

<div class="topic-metadata">

**Author:** [@brianguenter](https://discourse.julialang.org/u/brianguenter)\
**Replies:** 6\
**Last updated:** [August 4, 2024, 7:28pm UTC](https://discourse.julialang.org/t/problem-making-two-custom-number-types-work-together/117735 "2024-08-04T19:28:29Z")

</div>

I’ve defined a type of symbolic number, FastDifferentiation.Node, struct Node \<: Real ... end that causes this error when used with Quaternions.jl: julia\> using FastDifferentiation,Quaternions julia\> @variables x…

---

## [Running a Julia script from MATLAB using system()](https://discourse.julialang.org/t/running-a-julia-script-from-matlab-using-system/109931)

<div class="topic-metadata">

**Author:** [@rakshith95](https://discourse.julialang.org/u/rakshith95)\
**Replies:** 1\
**Last updated:** [February 9, 2024, 3:08pm UTC](https://discourse.julialang.org/t/running-a-julia-script-from-matlab-using-system/109931 "2024-02-09T15:08:26Z")

</div>

Hello, I’m trying to run a Julia .jl script in a MATLAB program using the system command. The script runs perfectly fine, when I attempt to do so from the terminal, but I get a segmentation fault when I try to run it th…

---

## [Feasibility of adding multiple inheritance to Julia](https://discourse.julialang.org/t/feasibility-of-adding-multiple-inheritance-to-julia/105382)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 36\
**Last updated:** [October 31, 2023, 6:03pm UTC](https://discourse.julialang.org/t/feasibility-of-adding-multiple-inheritance-to-julia/105382 "2023-10-31T18:03:11Z")

</div>

The topic of interfaces came up again in one of the correctness threads. My minimally informed opinion is that the best solution would be to add multiple inheritance to the language. How feasible would it be to add mult…

---

## [How to design a custom array-like type for physics calculations: balancing functionality and customization?](https://discourse.julialang.org/t/how-to-design-a-custom-array-like-type-for-physics-calculations-balancing-functionality-and-customization/103873)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 2\
**Last updated:** [September 16, 2023, 6:39am UTC](https://discourse.julialang.org/t/how-to-design-a-custom-array-like-type-for-physics-calculations-balancing-functionality-and-customization/103873 "2023-09-16T06:39:03Z")

</div>

I’m working on a project in physics where I need to create custom types that behave like arrays but don’t necessarily inherit from AbstractArray because I want to disable certain default functionalities. These types repr…

---

## [Interface pattern in Julia](https://discourse.julialang.org/t/interface-pattern-in-julia/101964)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 4\
**Last updated:** [July 24, 2023, 12:58am UTC](https://discourse.julialang.org/t/interface-pattern-in-julia/101964 "2023-07-24T00:58:44Z")

</div>

People have been asking for interfacing pattern in Julia, but we do things through multiple dispatch. Here’s how. Imagine you want an interface for an “ordered” type. ordered\_interface(x) = ordered\_interface(typeof(x))…

---

## [Static testing with JET vs interfaces](https://discourse.julialang.org/t/static-testing-with-jet-vs-interfaces/97985)

<div class="topic-metadata">

**Author:** [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Replies:** 5\
**Last updated:** [April 27, 2023, 9:47am UTC](https://discourse.julialang.org/t/static-testing-with-jet-vs-interfaces/97985 "2023-04-27T09:47:51Z")

</div>

Hi there! I’m starting to add JET testing to several packages, but I run into problems when I try to define abstract interfaces. As of right now, interfaces in Julia are mostly methodless functions with explicit documen…

---

## [When to Use An Interface ("Base-like") Package](https://discourse.julialang.org/t/when-to-use-an-interface-base-like-package/95580)

<div class="topic-metadata">

**Author:** [@astrobc1](https://discourse.julialang.org/u/astrobc1)\
**Replies:** 1\
**Last updated:** [March 5, 2023, 6:49pm UTC](https://discourse.julialang.org/t/when-to-use-an-interface-base-like-package/95580 "2023-03-05T18:49:35Z")

</div>

I’m uncertain as to at what point when developing a package it’s worth splitting things up into a “base” package containing the interface(s)/api + abstract types, and a “primary” package containing concrete types and imp…

---

## [RFC: Language Support for Traits — Yay or Nay?](https://discourse.julialang.org/t/rfc-language-support-for-traits-yay-or-nay/93914)

<div class="topic-metadata">

**Author:** [@uniment](https://discourse.julialang.org/u/uniment)\
**Replies:** 45\
**Last updated:** [February 8, 2023, 1:51am UTC](https://discourse.julialang.org/t/rfc-language-support-for-traits-yay-or-nay/93914 "2023-02-08T01:51:46Z")

</div>

A repeated gripe I see from the local gray-hairs about Julia’s type system pertains to the lack of language support for multiple inheritance through traits—to manage those pesky behaviors that fall outside the type hiera…

---

## [How do I define my own type based on Julia's pre-existing type?](https://discourse.julialang.org/t/how-do-i-define-my-own-type-based-on-julias-pre-existing-type/93835)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 4\
**Last updated:** [January 31, 2023, 8:54pm UTC](https://discourse.julialang.org/t/how-do-i-define-my-own-type-based-on-julias-pre-existing-type/93835 "2023-01-31T20:54:49Z")

</div>

Hello! I am trying to perform a simple experiment and need some help. I wish to make a copy of the AbstractVector type as such: struct AbstractVectorCopy{T} \<: AbstractVector{T} field::AbstractVector{T} end Then…

---

## [\[pre-ANN/RFC\] VectorInterface.jl](https://discourse.julialang.org/t/pre-ann-rfc-vectorinterface-jl/85231)

<div class="topic-metadata">

**Author:** [@juthohaegeman](https://discourse.julialang.org/u/juthohaegeman)\
**Replies:** 4\
**Last updated:** [August 3, 2022, 8:34pm UTC](https://discourse.julialang.org/t/pre-ann-rfc-vectorinterface-jl/85231 "2022-08-03T20:34:22Z")

</div>

This is more a “request for comments” than an announcement. I’ve just created (but not registered) a package called VectorInterface.jl. Why? The following is a copy of the README. It is long, but I wanted to do a decent …

---

## [AbstractVector vs AbstractRange: length vs size -- which is fundamental?](https://discourse.julialang.org/t/abstractvector-vs-abstractrange-length-vs-size-which-is-fundamental/64689)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 3\
**Last updated:** [July 28, 2022, 9:01pm UTC](https://discourse.julialang.org/t/abstractvector-vs-abstractrange-length-vs-size-which-is-fundamental/64689 "2022-07-28T21:01:17Z")

</div>

It appears that julia master has changed a behavior from previous versions, and now size for an AbstractRange is defined as (length(r),) instead of the previous behavior where length was defined as prod(size(r)). This ma…

---

## [What is the interface for abstract types in Base?](https://discourse.julialang.org/t/what-is-the-interface-for-abstract-types-in-base/79729)

<div class="topic-metadata">

**Author:** [@melonedo](https://discourse.julialang.org/u/melonedo)\
**Replies:** 2\
**Last updated:** [April 20, 2022, 11:14am UTC](https://discourse.julialang.org/t/what-is-the-interface-for-abstract-types-in-base/79729 "2022-04-20T11:14:23Z")

</div>

Julia has a well-defined interface for AbstractArray related in the documentation, however, I have difficulty finding interface for: AbstractString: displaying it requires ncodeunits(s::SomeString), iterate(s::SomeStr…

---

## [Any guides on designing an interface?](https://discourse.julialang.org/t/any-guides-on-designing-an-interface/77173)

<div class="topic-metadata">

**Author:** [@rikh](https://discourse.julialang.org/u/rikh)\
**Replies:** 3\
**Last updated:** [March 5, 2022, 7:37pm UTC](https://discourse.julialang.org/t/any-guides-on-designing-an-interface/77173 "2022-03-05T19:37:36Z")

</div>

I sometimes read things like how the Pkg.jl developers have thought long about how the API/Interface should look. The problem seems clear: “Make a useful interface”, but I don’t have any clue on how it can be approached.…

---

## [Is there a defined minimal interface for a type to work with SparseArrays?](https://discourse.julialang.org/t/is-there-a-defined-minimal-interface-for-a-type-to-work-with-sparsearrays/69602)

<div class="topic-metadata">

**Author:** [@suavesito](https://discourse.julialang.org/u/suavesito)\
**Replies:** 22\
**Last updated:** [October 21, 2021, 1:05pm UTC](https://discourse.julialang.org/t/is-there-a-defined-minimal-interface-for-a-type-to-work-with-sparsearrays/69602 "2021-10-21T13:05:14Z")

</div>

Hi! I’ve been trying to use Symbolics + SparseArrays, but I get errors because in SparseArrays to check for zeros it is used != 0 and that doesn’t work with Num. I learned about 30573 in which they discuss about this e…

[Next page](https://discourse.julialang.org/tag/interface/413.md?match_all_tags=true&page=1&tags%5B%5D=interface)
