# General Usage

**URL:** https://discourse.julialang.org/c/usage/6.md?page=116

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

**Page:** 117

---

## [REPL not found on Julia v1.11.1](https://discourse.julialang.org/t/repl-not-found-on-julia-v1-11-1/122120)

<div class="topic-metadata">

**Author:** [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Replies:** 3\
**Last updated:** [November 1, 2024, 5:16pm UTC](https://discourse.julialang.org/t/repl-not-found-on-julia-v1-11-1/122120 "2024-11-01T17:16:02Z")

</div>

Seeing this on my test jobs after updating Julia ERROR: KeyError: key "REPL" not found Stacktrace: \[1\] getindex @ ./dict.jl:477 \[inlined\] \[2\] Base.Precompilation.ExplicitEnv(envpath::String) @ Base.Precompil…

---

## [Why this function involving eachslice is type unstable?](https://discourse.julialang.org/t/why-this-function-involving-eachslice-is-type-unstable/122083)

<div class="topic-metadata">

**Author:** [@Oleg\_Soloviev](https://discourse.julialang.org/u/Oleg_Soloviev)\
**Replies:** 2\
**Last updated:** [November 1, 2024, 3:46pm UTC](https://discourse.julialang.org/t/why-this-function-involving-eachslice-is-type-unstable/122083 "2024-11-01T15:46:34Z")

</div>

I need to perform iteratively some operations slicewise in a multidimensional array, and I cannot make it type stable. Here is an MWE in follow-up to the examples from eachslice is type unstable · Issue #39639 · JuliaLa…

---

## [Create a more unified syntax for requesting a specific return type of functions?](https://discourse.julialang.org/t/create-a-more-unified-syntax-for-requesting-a-specific-return-type-of-functions/122067)

<div class="topic-metadata">

**Author:** [@stephancb](https://discourse.julialang.org/u/stephancb)\
**Replies:** 18\
**Last updated:** [November 1, 2024, 3:33pm UTC](https://discourse.julialang.org/t/create-a-more-unified-syntax-for-requesting-a-specific-return-type-of-functions/122067 "2024-11-01T15:33:19Z")

</div>

round(1.1) --\> 1.0 round(Int, 1.1) --\> 1 works, but not sqrt(Complex, -1) acos(Complex, 1.1) ... and other inverse trigonometric functions where the real domain is limited. In these cases the desired result is obtaina…

---

## [Docstring being replaced](https://discourse.julialang.org/t/docstring-being-replaced/122129)

<div class="topic-metadata">

**Author:** [@fmario](https://discourse.julialang.org/u/fmario)\
**Replies:** 0\
**Last updated:** [November 1, 2024, 1:11pm UTC](https://discourse.julialang.org/t/docstring-being-replaced/122129 "2024-11-01T13:11:49Z")

</div>

I make the following module: module Foo export Bar """ Bar Struct bar docstring. """ struct Bar n::Int @doc """ Bar(n::Int) Constructor docstring. """ function Bar(n::Int) …

---

## [Creating a new package version fails](https://discourse.julialang.org/t/creating-a-new-package-version-fails/122128)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 3\
**Last updated:** [November 1, 2024, 12:55pm UTC](https://discourse.julialang.org/t/creating-a-new-package-version-fails/122128 "2024-11-01T12:55:11Z")

</div>

I tried to release a new package version, which fails: The real problem is that there is no error message. How can I find out why it fails?

---

## [Getting the dimension value at eachslice of a DimArray](https://discourse.julialang.org/t/getting-the-dimension-value-at-eachslice-of-a-dimarray/122088)

<div class="topic-metadata">

**Author:** [@gmcardle](https://discourse.julialang.org/u/gmcardle)\
**Replies:** 1\
**Last updated:** [November 1, 2024, 9:29am UTC](https://discourse.julialang.org/t/getting-the-dimension-value-at-eachslice-of-a-dimarray/122088 "2024-11-01T09:29:06Z")

</div>

Hi, I’m still getting to grips with practical use of DimensionalData.jl DimArray types. Suppose I’m using eachslice to iterate over the time dimension of a 3D array, but I want to get the time value at each slice. What…

---

## [How to do high precision linear algebra with \`exp\` related functions?](https://discourse.julialang.org/t/how-to-do-high-precision-linear-algebra-with-exp-related-functions/122114)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 2\
**Last updated:** [November 1, 2024, 9:21am UTC](https://discourse.julialang.org/t/how-to-do-high-precision-linear-algebra-with-exp-related-functions/122114 "2024-11-01T09:21:18Z")

</div>

Is there a library that supports exp, sin, cos, etc., on matrices with precisions higher than Float64? Here’s my test code: julia\> A = rand(BigFloat, 10, 10); julia\> exp(A) ERROR: MethodError: no method matching exp!(:…

---

## [Troubleshooting allocations in SymbolicUtils code](https://discourse.julialang.org/t/troubleshooting-allocations-in-symbolicutils-code/122027)

<div class="topic-metadata">

**Author:** [@ctessum](https://discourse.julialang.org/u/ctessum)\
**Replies:** 2\
**Last updated:** [November 1, 2024, 8:57am UTC](https://discourse.julialang.org/t/troubleshooting-allocations-in-symbolicutils-code/122027 "2024-11-01T08:57:34Z")

</div>

Hello! I have some a model here that is having some performance issues. I’ve included below a screenshot of a performance profile: As you can see, the majority of the time is being taken up by a macro expansion in S…

---

## [Constant propagation with a namedtuple with one field](https://discourse.julialang.org/t/constant-propagation-with-a-namedtuple-with-one-field/121887)

<div class="topic-metadata">

**Author:** [@f.ij](https://discourse.julialang.org/u/f.ij)\
**Replies:** 6\
**Last updated:** [November 1, 2024, 8:03am UTC](https://discourse.julialang.org/t/constant-propagation-with-a-namedtuple-with-one-field/121887 "2024-11-01T08:03:30Z")

</div>

I’m trying to use the type of a NamedTuple to statically compile some parts of functions. I’ve found some unexpected behavior that I don’t really understand: When I use a NamedTuple with only one field it doesn’t seem to…

---

## [Incrementally creating docstrings](https://discourse.julialang.org/t/incrementally-creating-docstrings/122115)

<div class="topic-metadata">

**Author:** [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)\
**Replies:** 0\
**Last updated:** [November 1, 2024, 7:56am UTC](https://discourse.julialang.org/t/incrementally-creating-docstrings/122115 "2024-11-01T07:56:35Z")

</div>

I am in a situation where I would like to construct a docstring piece by piece rather than doing it in just one statement. I tried: module A varname = 0 @doc "Apple" varname @doc "$(@doc varname) Orange" varname end bu…

---

## [Threadsafe DBInterface.jl-like connection pool interface for thread-unsafe connections](https://discourse.julialang.org/t/threadsafe-dbinterface-jl-like-connection-pool-interface-for-thread-unsafe-connections/121081)

<div class="topic-metadata">

**Author:** [@littlelib](https://discourse.julialang.org/u/littlelib)\
**Replies:** 3\
**Last updated:** [November 1, 2024, 7:46am UTC](https://discourse.julialang.org/t/threadsafe-dbinterface-jl-like-connection-pool-interface-for-thread-unsafe-connections/121081 "2024-11-01T07:46:59Z")

</div>

In light of this post on database connection pools and concurrency, I’m trying making a threadsafe DBInterface.jl-like connection pool interface for thread-unsafe connections. It’s based on DBInterface.jl and Concurrent…

---

## [Kwargs unexpected (?) error](https://discourse.julialang.org/t/kwargs-unexpected-error/122089)

<div class="topic-metadata">

**Author:** [@aris](https://discourse.julialang.org/u/aris)\
**Replies:** 2\
**Last updated:** [October 31, 2024, 8:14pm UTC](https://discourse.julialang.org/t/kwargs-unexpected-error/122089 "2024-10-31T20:14:48Z")

</div>

I ran across the following while writing some code. function foo( x::Vector, y::Vector; cond=true) if cond return x .- y end end function bar(x, y; kwargs...) return foo(x, y, kwargs...) end # The…

---

## [Indexing vectors wtih BitVectors](https://discourse.julialang.org/t/indexing-vectors-wtih-bitvectors/122039)

<div class="topic-metadata">

**Author:** [@Yannik](https://discourse.julialang.org/u/Yannik)\
**Replies:** 3\
**Last updated:** [October 31, 2024, 5:47pm UTC](https://discourse.julialang.org/t/indexing-vectors-wtih-bitvectors/122039 "2024-10-31T17:47:34Z")

</div>

What is the intended behaivious of using bitvectors to index array? I have an example similar to a = \[1,2,3\] indexing = a .\< 1 # BitVector: 0, 1, 1 a\[indexing\]\[2\] = 100 but then a is still \> a \[1,2,3\] The 100 did no…

---

## [Compiling C++ file for usage in Julia](https://discourse.julialang.org/t/compiling-c-file-for-usage-in-julia/121693)

<div class="topic-metadata">

**Author:** [@Questioner](https://discourse.julialang.org/u/Questioner)\
**Replies:** 11\
**Last updated:** [October 31, 2024, 3:57pm UTC](https://discourse.julialang.org/t/compiling-c-file-for-usage-in-julia/121693 "2024-10-31T15:57:34Z")

</div>

I have been trying to replicate the example given in a different post, to which I can’t link, but here’s the relative URL: /t/can-someone-provide-a-simple-example-of-using-cxxwrap/115908/6 I’m on Windows (because there …

---

## [Performance benefits of writing getters for struct fields](https://discourse.julialang.org/t/performance-benefits-of-writing-getters-for-struct-fields/122076)

<div class="topic-metadata">

**Author:** [@danrib07](https://discourse.julialang.org/u/danrib07)\
**Replies:** 2\
**Last updated:** [October 31, 2024, 3:03pm UTC](https://discourse.julialang.org/t/performance-benefits-of-writing-getters-for-struct-fields/122076 "2024-10-31T15:03:45Z")

</div>

Is there a performance benefit of writing “getter” functions for structs in Julia? For example, let’s say I define a struct and a “get” function for its field: struct Foo bar end function get\_bar(foo::Foo) retu…

---

## [Package extension adding new function/variables to package namespace](https://discourse.julialang.org/t/package-extension-adding-new-function-variables-to-package-namespace/122034)

<div class="topic-metadata">

**Author:** [@SunnyUser](https://discourse.julialang.org/u/SunnyUser)\
**Replies:** 1\
**Last updated:** [October 31, 2024, 2:13pm UTC](https://discourse.julialang.org/t/package-extension-adding-new-function-variables-to-package-namespace/122034 "2024-10-31T14:13:57Z")

</div>

Hi all :slight\_smile: Short summary what I want: Assume I have package A with main module/namespace A and a test extension for A that means the extension gets only loaded if Test is loaded. Different package B imports…

---

## [Recommand \`curl | bash\` as default installation is not ideal?](https://discourse.julialang.org/t/recommand-curl-bash-as-default-installation-is-not-ideal/121820)

<div class="topic-metadata">

**Author:** [@jling](https://discourse.julialang.org/u/jling)\
**Replies:** 20\
**Last updated:** [October 31, 2024, 11:46am UTC](https://discourse.julialang.org/t/recommand-curl-bash-as-default-installation-is-not-ideal/121820 "2024-10-31T11:46:26Z")

</div>

Right now if you visit Installing Julia you see something like this: I think it’s reasonable for people to frown upon this, for one, it’s not a reproducible way to install Julia, it depends on what you get at the mom…

---

## [In what cases does Cthulhu.jl give a more precise inferred return type than Julia's built-in return type inference?](https://discourse.julialang.org/t/in-what-cases-does-cthulhu-jl-give-a-more-precise-inferred-return-type-than-julias-built-in-return-type-inference/122064)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 0\
**Last updated:** [October 31, 2024, 10:19am UTC](https://discourse.julialang.org/t/in-what-cases-does-cthulhu-jl-give-a-more-precise-inferred-return-type-than-julias-built-in-return-type-inference/122064 "2024-10-31T10:19:15Z")

</div>

I was testing the inferrability of some of my code with Base.infer\_return\_type, and found a case with suboptimal abstract inference. When I tried using Cthulhu.jl to debug this, though, descend shows a more precise, opti…

---

## [A function return type of \`::AbstractArray{AbstractString}\` causes a performance penalty?](https://discourse.julialang.org/t/a-function-return-type-of-abstractarray-abstractstring-causes-a-performance-penalty/122003)

<div class="topic-metadata">

**Author:** [@Vincent\_Picaud](https://discourse.julialang.org/u/Vincent_Picaud)\
**Replies:** 15\
**Last updated:** [October 31, 2024, 9:58am UTC](https://discourse.julialang.org/t/a-function-return-type-of-abstractarray-abstractstring-causes-a-performance-penalty/122003 "2024-10-31T09:58:00Z")

</div>

For clarity reason, I sometimes annotated return type. However, I stopped when I realized this : Given: foo()::AbstractVector{AbstractString} = \[“hello”\] foo2() = \[“hello”\] fii(v) = println(eltype(v)) fii2(v) = @i…

---

## [Load sysimage so fail](https://discourse.julialang.org/t/load-sysimage-so-fail/121972)

<div class="topic-metadata">

**Author:** [@ck\_dominer](https://discourse.julialang.org/u/ck_dominer)\
**Replies:** 9\
**Last updated:** [October 31, 2024, 6:26am UTC](https://discourse.julialang.org/t/load-sysimage-so-fail/121972 "2024-10-31T06:26:46Z")

</div>

I generate a sysimage by PackgeCompiler. this is my command: using PackageCompiler; create\_sysimage(\["CoreToolbox"\]; sysimage\_path="CTBSysimage.so", include\_transitive\_dependencies=false) When I use this package, it r…

---

## [RFC: macro for checking that a struct is concretely typed](https://discourse.julialang.org/t/rfc-macro-for-checking-that-a-struct-is-concretely-typed/122017)

<div class="topic-metadata">

**Author:** [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Replies:** 10\
**Last updated:** [October 31, 2024, 6:20am UTC](https://discourse.julialang.org/t/rfc-macro-for-checking-that-a-struct-is-concretely-typed/122017 "2024-10-31T06:20:25Z")

</div>

This week I gave a tutorial on performance in Julia and helped a few beginners optimize their code. One of the most frequent mistakes was structs with abstractly-typed fields. As a pedagogical tool, @serenity4 and I wro…

---

## [Curl\_multi\_assign and segmentation fault when installing package](https://discourse.julialang.org/t/curl-multi-assign-and-segmentation-fault-when-installing-package/120901)

<div class="topic-metadata">

**Author:** [@arnerob](https://discourse.julialang.org/u/arnerob)\
**Replies:** 5\
**Last updated:** [October 4, 2024, 5:31pm UTC](https://discourse.julialang.org/t/curl-multi-assign-and-segmentation-fault-when-installing-package/120901 "2024-10-04T17:31:04Z")

</div>

I recently switched to Apple M2 and I tried to install FFTW.jl. I did the following in a fresh REPL: julia\> using Pkg julia\> Pkg.add("FFTW") Resolving package versions... Updating \`~/.julia/environments/v1.10/Pr…

---

## [Cannot create 2D Cartesian points with specified units](https://discourse.julialang.org/t/cannot-create-2d-cartesian-points-with-specified-units/122020)

<div class="topic-metadata">

**Author:** [@prittjam](https://discourse.julialang.org/u/prittjam)\
**Replies:** 12\
**Last updated:** [October 30, 2024, 10:45pm UTC](https://discourse.julialang.org/t/cannot-create-2d-cartesian-points-with-specified-units/122020 "2024-10-30T22:45:40Z")

</div>

using CoordRefSystems, Unitful rand(Cartesian2D{NoDatum, typeof(1.0u"m")}) does not work.

---

## [Very Slow \`DBInterface.execute\` on large duckdb relative to R](https://discourse.julialang.org/t/very-slow-dbinterface-execute-on-large-duckdb-relative-to-r/121984)

<div class="topic-metadata">

**Author:** [@floswald](https://discourse.julialang.org/u/floswald)\
**Replies:** 4\
**Last updated:** [October 30, 2024, 9:11pm UTC](https://discourse.julialang.org/t/very-slow-dbinterface-execute-on-large-duckdb-relative-to-r/121984 "2024-10-30T21:11:59Z")

</div>

Hi all, I’ve made a clone of @grantmcdermott 's nice workshop on duckdb and polars - adding a chapter on julia and duckdb. He had pointed out some very slow julia timings in his slides, and actually created an issue on …

---

## [Webpage with reactive plot animation](https://discourse.julialang.org/t/webpage-with-reactive-plot-animation/121570)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 3\
**Last updated:** [October 30, 2024, 6:02pm UTC](https://discourse.julialang.org/t/webpage-with-reactive-plot-animation/121570 "2024-10-30T18:02:44Z")

</div>

I’d like to have a webpage with a plot which gets updated automatically every second, and which depends on some user input. Schematically, something like: julia\> xs = \[0\]; vx = ReactiveSlider(initial\_value=1) whi…

---

## [Appending new formatted lines in a file using writedlm()?](https://discourse.julialang.org/t/appending-new-formatted-lines-in-a-file-using-writedlm/121915)

<div class="topic-metadata">

**Author:** [@ValeFed](https://discourse.julialang.org/u/ValeFed)\
**Replies:** 1\
**Last updated:** [October 30, 2024, 5:55pm UTC](https://discourse.julialang.org/t/appending-new-formatted-lines-in-a-file-using-writedlm/121915 "2024-10-30T17:55:59Z")

</div>

Hi there. My ingredients are some coordinates and a function N that returns a 4-element Vector. I need to create a txt file that has as colums x,y, N\[1\], N\[2\], N\[3\] and N\[4\]. Two other important info are that N is creat…

---

## [Create a boolean mask between arrays of different size](https://discourse.julialang.org/t/create-a-boolean-mask-between-arrays-of-different-size/121986)

<div class="topic-metadata">

**Author:** [@Ju\_ska](https://discourse.julialang.org/u/Ju_ska)\
**Replies:** 10\
**Last updated:** [October 30, 2024, 4:43pm UTC](https://discourse.julialang.org/t/create-a-boolean-mask-between-arrays-of-different-size/121986 "2024-10-30T16:43:34Z")

</div>

Hi, I would like to do the same thing as in python: import numpy as np a=\[1,2,3,4,5,6,7\] b=\[2,4,6\] mask=np.isin(a,b) giving \>\>\> mask array(\[False, True, False, True, False, True, False\]) In julia I can: mask = in…

---

## [Do you put return type in function definitions?](https://discourse.julialang.org/t/do-you-put-return-type-in-function-definitions/32120)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 14\
**Last updated:** [May 12, 2022, 7:15pm UTC](https://discourse.julialang.org/t/do-you-put-return-type-in-function-definitions/32120 "2022-05-12T19:15:43Z")

</div>

Do you have any opinion about annotating function definitions with return types? Like it or not and why? Here’s a dummy example: add(x, y)::Int = x + y It gives additional type checking: julia\> add(1,2) 3 julia\> ad…

---

## [Pointer to stackframe in Julia, VLA/alloca-like; with e.g. StaticString.jl](https://discourse.julialang.org/t/pointer-to-stackframe-in-julia-vla-alloca-like-with-e-g-staticstring-jl/121992)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 5\
**Last updated:** [October 30, 2024, 2:57pm UTC](https://discourse.julialang.org/t/pointer-to-stackframe-in-julia-vla-alloca-like-with-e-g-staticstring-jl/121992 "2024-10-30T14:57:05Z")

</div>

I’m optimizing allocations away, for printing general strings (one of the last one is because of Libc.malloc(200), effectively in Julia, and it could be on the stack if Julia had such capability like in C). It IS danger…

---

## [Why does a vector with 10 times more elements takes 2x-5x less time to pre-allocate?](https://discourse.julialang.org/t/why-does-a-vector-with-10-times-more-elements-takes-2x-5x-less-time-to-pre-allocate/121828)

<div class="topic-metadata">

**Author:** [@Olegg](https://discourse.julialang.org/u/Olegg)\
**Replies:** 14\
**Last updated:** [October 30, 2024, 1:13pm UTC](https://discourse.julialang.org/t/why-does-a-vector-with-10-times-more-elements-takes-2x-5x-less-time-to-pre-allocate/121828 "2024-10-30T13:13:11Z")

</div>

I’m benchmarking pre-allocation of vectors: display(@benchmark Vector{Int}(undef, 1000) ) display(@benchmark Vector{Int}(undef, 10000) ) display(@benchmark Vector{Int}(undef, 1000) ) display(@benchmark Vector{Int}(u…

[Previous page](https://discourse.julialang.org/c/usage/6.md?page=115)

[Next page](https://discourse.julialang.org/c/usage/6.md?page=117)
