# \#base

**URL:** https://discourse.julialang.org/tag/base/396.md

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

---

## [Proposal to add method \`Base.read(io::IO, ::Type{T}) where T \<: IO\`](https://discourse.julialang.org/t/proposal-to-add-method-base-read-io-io-type-t-where-t-io/137044)

<div class="topic-metadata">

**Author:** [@hhaensel](https://discourse.julialang.org/u/hhaensel)\
**Replies:** 4\
**Last updated:** [May 8, 2026, 4:11pm UTC](https://discourse.julialang.org/t/proposal-to-add-method-base-read-io-io-type-t-where-t-io/137044 "2026-05-08T16:11:12Z")

</div>

Currently Base.read() does support read(src, String) read(src, Int32) but the following signatures are failing read(src, IOBuffer) read(src, Base.SecretBuffer) What do you think about introducing """ read(io::IO…

---

## [Should reduce throw an error on infinite iterators?](https://discourse.julialang.org/t/should-reduce-throw-an-error-on-infinite-iterators/136389)

<div class="topic-metadata">

**Author:** [@HMegh](https://discourse.julialang.org/u/HMegh)\
**Replies:** 4\
**Last updated:** [March 26, 2026, 5:27pm UTC](https://discourse.julialang.org/t/should-reduce-throw-an-error-on-infinite-iterators/136389 "2026-03-26T17:27:40Z")

</div>

Currently, reduce (and by extension mapreduce, sum and other functions) operate on iterators without checking whether they are finite or not. For example julia\> sum(Iterators.cycle(\[1,2,3\])) would run forever. I wanted…

---

## [Invalid JETLS warning, buggy kwdef macro](https://discourse.julialang.org/t/invalid-jetls-warning-buggy-kwdef-macro/134776)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 17\
**Last updated:** [December 30, 2025, 8:28am UTC](https://discourse.julialang.org/t/invalid-jetls-warning-buggy-kwdef-macro/134776 "2025-12-30T08:28:03Z")

</div>

The following code: Base.@kwdef mutable struct SysState{P} acc::Float64 = 0 "vector of particle positions in x \[m\]" X::MVector{P, Float64} = zeros(P) end gives the warning: \`KiteUtils.P\` is not defined I …

---

## [Numeric stability of Base.exp of static matrix of Float32](https://discourse.julialang.org/t/numeric-stability-of-base-exp-of-static-matrix-of-float32/133389)

<div class="topic-metadata">

**Author:** [@Xu\_Shan](https://discourse.julialang.org/u/Xu_Shan)\
**Replies:** 12\
**Last updated:** [October 26, 2025, 7:46pm UTC](https://discourse.julialang.org/t/numeric-stability-of-base-exp-of-static-matrix-of-float32/133389 "2025-10-26T19:46:53Z")

</div>

Guys, I want to use Base.exp in my model which uses Float32 with StaticArray and StaticVector. However, I found there is a numerical instability of Base.exp with the 3\*3 matrix…see the example above: using StaticArrays…

---

## [Any workaround to a bug in Base.cp?](https://discourse.julialang.org/t/any-workaround-to-a-bug-in-base-cp/59698)

<div class="topic-metadata">

**Author:** [@asyrov](https://discourse.julialang.org/u/asyrov)\
**Replies:** 2\
**Last updated:** [April 20, 2021, 9:43pm UTC](https://discourse.julialang.org/t/any-workaround-to-a-bug-in-base-cp/59698 "2021-04-20T21:43:38Z")

</div>

I’m trying to copy large (few GB) file using cp and the call fails with sendfile: unknown system error -208860302. This bug appears to be open already (IOError from cp with large file on Windows · Issue #30723 · JuliaLan…

---

## [\`hasfield\` and \`getkey\` in namedtuple](https://discourse.julialang.org/t/hasfield-and-getkey-in-namedtuple/132616)

<div class="topic-metadata">

**Author:** [@Marco\_Lombardi](https://discourse.julialang.org/u/Marco_Lombardi)\
**Replies:** 5\
**Last updated:** [September 25, 2025, 8:32am UTC](https://discourse.julialang.org/t/hasfield-and-getkey-in-namedtuple/132616 "2025-09-25T08:32:59Z")

</div>

Just a curiosity: is there any particular reason for the slightly odd choice of access functions for named tuples? I would expect to have hasfield and getfield, or alternatively haskey and getkey, but I see a mixture of …

---

## [When does it make sense to use \`Base.MultiplicativeInverses\`](https://discourse.julialang.org/t/when-does-it-make-sense-to-use-base-multiplicativeinverses/131711)

<div class="topic-metadata">

**Author:** [@kunzaatko](https://discourse.julialang.org/u/kunzaatko)\
**Replies:** 6\
**Last updated:** [August 19, 2025, 4:18pm UTC](https://discourse.julialang.org/t/when-does-it-make-sense-to-use-base-multiplicativeinverses/131711 "2025-08-19T16:18:05Z")

</div>

When does it make sense to use the Base.MultiplicativeInverses? I am considering storing the MultiplicativeInverse in my AbstractArray subtype which uses some index calculations based on some fields and the parent array.…

---

## [How would I view/use Number Base from 2 to 256](https://discourse.julialang.org/t/how-would-i-view-use-number-base-from-2-to-256/129412)

<div class="topic-metadata">

**Author:** [@two\_four\_six](https://discourse.julialang.org/u/two_four_six)\
**Replies:** 4\
**Last updated:** [July 13, 2025, 10:47am UTC](https://discourse.julialang.org/t/how-would-i-view-use-number-base-from-2-to-256/129412 "2025-07-13T10:47:14Z")

</div>

Data at rest is binary. When I read a file, it is presented in an output, like print() in hex. Julia converts the binary state of the file and outputs the hex info. This isn’t the behavior I need. I would like to take …

---

## [Reinterpret vector of mixed-type tuples](https://discourse.julialang.org/t/reinterpret-vector-of-mixed-type-tuples/127230)

<div class="topic-metadata">

**Author:** [@hhaensel](https://discourse.julialang.org/u/hhaensel)\
**Replies:** 4\
**Last updated:** [March 21, 2025, 10:52pm UTC](https://discourse.julialang.org/t/reinterpret-vector-of-mixed-type-tuples/127230 "2025-03-21T22:52:36Z")

</div>

I want to reinterpret a vector of mixed-type tuples as a vector of UInt8, however, I receive an error: b = reinterpret(UInt8, Tuple{UInt8, UInt32}\[(1, 2)\]); b\[1\] This is very close to the docs example of reinterpret, w…

---

## [Method for \`Base.length\` on a \`const\` type alias crashes julia](https://discourse.julialang.org/t/method-for-base-length-on-a-const-type-alias-crashes-julia/118169)

<div class="topic-metadata">

**Author:** [@kunzaatko](https://discourse.julialang.org/u/kunzaatko)\
**Replies:** 7\
**Last updated:** [August 15, 2024, 8:36am UTC](https://discourse.julialang.org/t/method-for-base-length-on-a-const-type-alias-crashes-julia/118169 "2024-08-15T08:36:05Z")

</div>

Julia is crashing when I try to define a Base.length method on a const type alias. julia\> import Base: length julia\> const A{N} = NTuple{N, Int64} Tuple{Vararg{Int64, N}} where N julia\> length(a::A) = prod(a) After …

---

## [Output from Base.find\_package?](https://discourse.julialang.org/t/output-from-base-find-package/117829)

<div class="topic-metadata">

**Author:** [@pywugate](https://discourse.julialang.org/u/pywugate)\
**Replies:** 1\
**Last updated:** [August 5, 2024, 10:41am UTC](https://discourse.julialang.org/t/output-from-base-find-package/117829 "2024-08-05T10:41:40Z")

</div>

Hi all, I have a question about the behaviour of Base.find\_package. I know package can be found : if the package is already installed. by using CSV But when I follow this tuto: How to develop a Julia package for dev…

---

## [Can't use Process type even though it's in Base.jl](https://discourse.julialang.org/t/cant-use-process-type-even-though-its-in-base-jl/106974)

<div class="topic-metadata">

**Author:** [@Conrad\_Wiebe](https://discourse.julialang.org/u/Conrad_Wiebe)\
**Replies:** 1\
**Last updated:** [December 1, 2023, 4:22am UTC](https://discourse.julialang.org/t/cant-use-process-type-even-though-its-in-base-jl/106974 "2023-12-01T04:22:31Z")

</div>

I see Process defined in process.jl: and included in Base here: but if I use it in code, it isn’t recognized: why is this? Tested on versions: 1.10.0-beta3+0.aarch64.apple.darwin14 1.10.0-rc1+0.aarch64.ap…

---

## [A bug in using varinfo() when there is 3d data in the struct structure!](https://discourse.julialang.org/t/a-bug-in-using-varinfo-when-there-is-3d-data-in-the-struct-structure/104449)

<div class="topic-metadata">

**Author:** [@13299118606](https://discourse.julialang.org/u/13299118606)\
**Replies:** 4\
**Last updated:** [October 3, 2023, 7:40am UTC](https://discourse.julialang.org/t/a-bug-in-using-varinfo-when-there-is-3d-data-in-the-struct-structure/104449 "2023-10-03T07:40:36Z")

</div>

There is a bug in using varinfo when there is three-dimensional data in the struct structure. When there is 3d data inside the structure, it will greatly slow down the corresponding response speed when using varinfo. The…

---

## [Vector with negative indices extending getindex](https://discourse.julialang.org/t/vector-with-negative-indices-extending-getindex/104286)

<div class="topic-metadata">

**Author:** [@gvdr](https://discourse.julialang.org/u/gvdr)\
**Replies:** 4\
**Last updated:** [September 27, 2023, 12:19am UTC](https://discourse.julialang.org/t/vector-with-negative-indices-extending-getindex/104286 "2023-09-27T00:19:00Z")

</div>

Hello. I’m trying to extend the method(s) for get index so to have the ability of accessing a numeric vector, Vector{T} where T\<:Number, at a negative (or zero) index and get zero(T). The intended behaviour is something…

---

## [Conversion of nothing to void pointer](https://discourse.julialang.org/t/conversion-of-nothing-to-void-pointer/102766)

<div class="topic-metadata">

**Author:** [@projekter](https://discourse.julialang.org/u/projekter)\
**Replies:** 11\
**Last updated:** [August 14, 2023, 1:10pm UTC](https://discourse.julialang.org/t/conversion-of-nothing-to-void-pointer/102766 "2023-08-14T13:10:37Z")

</div>

It is quite common in C interfaces to have functions that accept pointers to something, but they can also be given NULL instead, which means that for example the part that is related with this parameter is not of interes…

---

## [Overload in place =](https://discourse.julialang.org/t/overload-in-place/100331)

<div class="topic-metadata">

**Author:** [@Veenty](https://discourse.julialang.org/u/Veenty)\
**Replies:** 5\
**Last updated:** [June 14, 2023, 3:50pm UTC](https://discourse.julialang.org/t/overload-in-place/100331 "2023-06-14T15:50:08Z")

</div>

I have a custom type that looks like this struct foo{T} A1::Array{T} A2::Array{T} end function Base.:+(x:: foo, y:: foo) return foo(x.A1 + y.A1, x.A2 + y.A2) end function Base.:.=(x:: foo, y:: foo) x.A1 .= y.A1 x…

---

## [Integer power of large Integer returning very wrong results](https://discourse.julialang.org/t/integer-power-of-large-integer-returning-very-wrong-results/98747)

<div class="topic-metadata">

**Author:** [@dmetivie](https://discourse.julialang.org/u/dmetivie)\
**Replies:** 7\
**Last updated:** [May 15, 2023, 10:49am UTC](https://discourse.julialang.org/t/integer-power-of-large-integer-returning-very-wrong-results/98747 "2023-05-15T10:49:46Z")

</div>

I am with Julia 1.9 on a fresh session (windows). (Maybe it happens on previous version already) Is it normal to get stuff like julia\> 5^2000 -7794321243379011391 julia\> 2^200 0 With floating power 5^2000., it is Inf.…

---

## [Hex2bytes: length of iterable must be even](https://discourse.julialang.org/t/hex2bytes-length-of-iterable-must-be-even/97704)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 15\
**Last updated:** [April 20, 2023, 3:14pm UTC](https://discourse.julialang.org/t/hex2bytes-length-of-iterable-must-be-even/97704 "2023-04-20T15:14:14Z")

</div>

Hi there, it seems hex2bytes is really not safe, but depending on the concrete number, it will throw an error. Workaround: using "0" \* string(65537, base=16), but this looks really weird. Can someone explain why such a …

---

## [Is there a dedicated function computing m::Int = log(b, b^m)?](https://discourse.julialang.org/t/is-there-a-dedicated-function-computing-m-int-log-b-b-m/89776)

<div class="topic-metadata">

**Author:** [@dmetivie](https://discourse.julialang.org/u/dmetivie)\
**Replies:** 12\
**Last updated:** [November 4, 2022, 8:19pm UTC](https://discourse.julialang.org/t/is-there-a-dedicated-function-computing-m-int-log-b-b-m/89776 "2022-11-04T20:19:20Z")

</div>

I want to compute the integer m in m = log(b, y) for b integer, y=b^m. It would return an error if y is not a power of b. Right now, using the log is not ideal since julia\> log(7,7^5) 5.000000000000001 which is not a…

---

## [Error calling \`similar(Array{ComplexF32}, Float32)\`](https://discourse.julialang.org/t/error-calling-similar-array-complexf32-float32/86248)

<div class="topic-metadata">

**Author:** [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Replies:** 11\
**Last updated:** [August 30, 2022, 10:18am UTC](https://discourse.julialang.org/t/error-calling-similar-array-complexf32-float32/86248 "2022-08-30T10:18:12Z")

</div>

writing code that is agnostic about the array type but can still change the element\_type, one wants to keep the array type but change the element-type for example to real(eltype(ArrayType)) for efficiency reasons. The f…

---

## [Should \`convert\` include a type-assertion to ensure that the conversion succeeds?](https://discourse.julialang.org/t/should-convert-include-a-type-assertion-to-ensure-that-the-conversion-succeeds/85577)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 1\
**Last updated:** [August 10, 2022, 9:41am UTC](https://discourse.julialang.org/t/should-convert-include-a-type-assertion-to-ensure-that-the-conversion-succeeds/85577 "2022-08-10T09:41:02Z")

</div>

For example, in badly inferred code, one may obtain julia\> @code\_warntype (x -\> convert(Int, x\[1\]))(Any\[1\]) MethodInstance for (::var"#3#4")(::Vector{Any}) from (::var"#3#4")(x) @ Main REPL\[5\]:1 Arguments #self#::…

---

## [Move Random into Base?](https://discourse.julialang.org/t/move-random-into-base/80669)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 22\
**Last updated:** [May 9, 2022, 7:51pm UTC](https://discourse.julialang.org/t/move-random-into-base/80669 "2022-05-09T19:51:01Z")

</div>

It would be nice to have quicksort select its pivot randomly rather than using median of three to prevent malicious data from causing unexpected quadratic runtime. Benchmarking reveals that this causes negligible perform…

---

## [Instances for type](https://discourse.julialang.org/t/instances-for-type/80549)

<div class="topic-metadata">

**Author:** [@vamp](https://discourse.julialang.org/u/vamp)\
**Replies:** 4\
**Last updated:** [May 5, 2022, 5:01pm UTC](https://discourse.julialang.org/t/instances-for-type/80549 "2022-05-05T17:01:48Z")

</div>

How to import Base: ! when I get no method matching !??

---

## [Distinguish dictionary lookup from nothing and not found?](https://discourse.julialang.org/t/distinguish-dictionary-lookup-from-nothing-and-not-found/38654)

<div class="topic-metadata">

**Author:** [@thautwarm](https://discourse.julialang.org/u/thautwarm)\
**Replies:** 22\
**Last updated:** [April 12, 2022, 5:49pm UTC](https://discourse.julialang.org/t/distinguish-dictionary-lookup-from-nothing-and-not-found/38654 "2022-04-12T17:49:46Z")

</div>

get(dict, key, nothing) can be ambiguous as it can means dict\[key\] === nothing or key not found. Without a get function returning Union{Some{T}, Nothing}, I have to choose the following options, which turns out to troub…

---

## [Profiling Revised Base](https://discourse.julialang.org/t/profiling-revised-base/76599)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 2\
**Last updated:** [February 17, 2022, 3:14am UTC](https://discourse.julialang.org/t/profiling-revised-base/76599 "2022-02-17T03:14:49Z")

</div>

After running Revise.track(Base) and editing files in Base, @profile & Profile.print() give wrong line numbers. Is there a way around this?

---

## [Finding the module of a callsite in the stacktrace](https://discourse.julialang.org/t/finding-the-module-of-a-callsite-in-the-stacktrace/65191)

<div class="topic-metadata">

**Author:** [@haberdashPI](https://discourse.julialang.org/u/haberdashPI)\
**Replies:** 0\
**Last updated:** [July 23, 2021, 4:42pm UTC](https://discourse.julialang.org/t/finding-the-module-of-a-callsite-in-the-stacktrace/65191 "2021-07-23T16:42:58Z")

</div>

I want to get an item returned from stacktrace() such that it is the first StackFrame for which getmodule(x) == m where m is some known module. This works: getmodule(x) = nothing getmodule(x::Base.StackTraces.StackFrame…

---

## [Periods / shifts argument for the diff function](https://discourse.julialang.org/t/periods-shifts-argument-for-the-diff-function/63701)

<div class="topic-metadata">

**Author:** [@scimas](https://discourse.julialang.org/u/scimas)\
**Replies:** 7\
**Last updated:** [June 28, 2021, 4:33pm UTC](https://discourse.julialang.org/t/periods-shifts-argument-for-the-diff-function/63701 "2021-06-28T16:33:52Z")

</div>

The diff function doesn’t have a periods / shifts argument, similar to the equivalent pandas function. But looking at the julia source code, it seems it would be easy to add it without breaking any existing code. So bef…

---

## [Indexing assignment to arrays](https://discourse.julialang.org/t/indexing-assignment-to-arrays/57008)

<div class="topic-metadata">

**Author:** [@pshsr](https://discourse.julialang.org/u/pshsr)\
**Replies:** 4\
**Last updated:** [March 14, 2021, 12:37pm UTC](https://discourse.julialang.org/t/indexing-assignment-to-arrays/57008 "2021-03-14T12:37:13Z")

</div>

The documentation for indexing assignment in the Julia manual says that: If any index I\_k selects more than one location, then the right hand side X must be an array with the same shape as the result of indexing A\[I\_1,…

---

## [Base.factorial: Extending and overwriting functions in SpecialFunctions](https://discourse.julialang.org/t/base-factorial-extending-and-overwriting-functions-in-specialfunctions/53486)

<div class="topic-metadata">

**Author:** [@mr.red](https://discourse.julialang.org/u/mr.red)\
**Replies:** 1\
**Last updated:** [January 19, 2021, 11:46am UTC](https://discourse.julialang.org/t/base-factorial-extending-and-overwriting-functions-in-specialfunctions/53486 "2021-01-19T11:46:14Z")

</div>

The Base.factorial function supplies the following methods julia\> methods(factorial) # 7 methods for generic function "factorial": \[1\] factorial(n::UInt128) in Base at combinatorics.jl:26 \[2\] factorial(n::Int128) in Bas…

---

## [Extending function from Base](https://discourse.julialang.org/t/extending-function-from-base/53414)

<div class="topic-metadata">

**Author:** [@mr.red](https://discourse.julialang.org/u/mr.red)\
**Replies:** 5\
**Last updated:** [January 16, 2021, 4:11pm UTC](https://discourse.julialang.org/t/extending-function-from-base/53414 "2021-01-16T16:11:56Z")

</div>

The function Base.binomial(n, k) has 3 different calling patterns: julia\> methods(Base.binomial) # 3 methods for generic function "binomial": \[1\] binomial(n::BigInt, k::UInt64) in Base.GMP at gmp.jl:641 \[2\] binomial(n::…

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