# General Usage

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

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

**Page:** 87

---

## [Local macros](https://discourse.julialang.org/t/local-macros/125539)

<div class="topic-metadata">

**Author:** [@Mark\_Nahabedian](https://discourse.julialang.org/u/Mark_Nahabedian)\
**Replies:** 4\
**Last updated:** [February 14, 2025, 6:42pm UTC](https://discourse.julialang.org/t/local-macros/125539 "2025-02-14T18:42:38Z")

</div>

In CommonLisp one can define local macros using MACROLET. Julia doesn’t have local macros, but one can imagine that a given global macro could provide local macros for use wwithin its body using a code walker and rules …

---

## [Elapsed + allocated?](https://discourse.julialang.org/t/elapsed-allocated/125910)

<div class="topic-metadata">

**Author:** [@Sarah\_Groves](https://discourse.julialang.org/u/Sarah_Groves)\
**Replies:** 4\
**Last updated:** [February 14, 2025, 5:08pm UTC](https://discourse.julialang.org/t/elapsed-allocated/125910 "2025-02-14T17:08:53Z")

</div>

I am familiar with the @elapsed and @allocated functions that allow me to save as a variable either the elapsed time and allocated memory during a function run (respectively). Is there a method that will return both vari…

---

## [Why is the NamedTuple slower? When/How would it be faster? Is it still allocated on the stack?](https://discourse.julialang.org/t/why-is-the-namedtuple-slower-when-how-would-it-be-faster-is-it-still-allocated-on-the-stack/125902)

<div class="topic-metadata">

**Author:** [@Vik1](https://discourse.julialang.org/u/Vik1)\
**Replies:** 6\
**Last updated:** [February 14, 2025, 4:54pm UTC](https://discourse.julialang.org/t/why-is-the-namedtuple-slower-when-how-would-it-be-faster-is-it-still-allocated-on-the-stack/125902 "2025-02-14T16:54:48Z")

</div>

In the following case, the Dict beats the NamedTuple in the creation and in the lookup? Why is this the case? Am I missing something? using BenchmarkTools tup1 = NamedTuple(k =\> v for (k, v) in \[(:a, 5), (:b, 10)\]) tup…

---

## [Compilation problem](https://discourse.julialang.org/t/compilation-problem/125907)

<div class="topic-metadata">

**Author:** [@gustave\_Robichon](https://discourse.julialang.org/u/gustave_Robichon)\
**Replies:** 3\
**Last updated:** [February 14, 2025, 4:21pm UTC](https://discourse.julialang.org/t/compilation-problem/125907 "2025-02-14T16:21:29Z")

</div>

Hello :slight\_smile: I am using the package QuantumOptics. I use the function : timeevolution.master\_h(T, rho0, H, L). I get this compilation error (see below). I think I have updated the packages, and a version changed…

---

## [Use @example within expandable block in Documenter.jl](https://discourse.julialang.org/t/use-example-within-expandable-block-in-documenter-jl/106436)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 3\
**Last updated:** [February 14, 2025, 10:59am UTC](https://discourse.julialang.org/t/use-example-within-expandable-block-in-documenter-jl/106436 "2025-02-14T10:59:10Z")

</div>

I am using Documenter.jl and would like to place an @example block inside an expandable code block. Here is what I am trying to do ( sorry for the screenshot; the code does not properly display) : This does not work. …

---

## [Repository error in Julia 1.6.7](https://discourse.julialang.org/t/repository-error-in-julia-1-6-7/125890)

<div class="topic-metadata">

**Author:** [@photor](https://discourse.julialang.org/u/photor)\
**Replies:** 5\
**Last updated:** [February 14, 2025, 9:41am UTC](https://discourse.julialang.org/t/repository-error-in-julia-1-6-7/125890 "2025-02-14T09:41:04Z")

</div>

(@v1.6) pkg\> up Updating registry at \`C:\\Users\\photo\\.julia\\registries\\General\` ERROR: GitError(Code:ENOTFOUND, Class:Repository, could not find repository from 'C:\\Users\\photo\\.julia\\registries\\General') Stacktrace:…

---

## [Could people suggest a few packages to study?](https://discourse.julialang.org/t/could-people-suggest-a-few-packages-to-study/125852)

<div class="topic-metadata">

**Author:** [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Replies:** 9\
**Last updated:** [February 14, 2025, 7:04am UTC](https://discourse.julialang.org/t/could-people-suggest-a-few-packages-to-study/125852 "2025-02-14T07:04:08Z")

</div>

I’m trying to assemble the beginnings of one, and I’d like to study a few non-trivial but not too huge examples before getting my code in shape for wider publication. Any suggestions?

---

## [Unitful.jl and Mixing Ratios](https://discourse.julialang.org/t/unitful-jl-and-mixing-ratios/125883)

<div class="topic-metadata">

**Author:** [@natgeo-wong](https://discourse.julialang.org/u/natgeo-wong)\
**Replies:** 1\
**Last updated:** [February 14, 2025, 1:53am UTC](https://discourse.julialang.org/t/unitful-jl-and-mixing-ratios/125883 "2025-02-14T01:53:07Z")

</div>

Hi! I have a question. In Climate Science, it is very common for units to be expressed in kg kg^-1 (e.g., specific humidity). However, in Unitful.jl this is taken to be (i.e., unitless), which while technically accura…

---

## [Gksqt: symbol lookup error: /lib/x86\_64-linux-gnu/libEGL\_mesa.so.0: undefined symbol: wl\_display\_create\_queue\_with\_name](https://discourse.julialang.org/t/gksqt-symbol-lookup-error-lib-x86-64-linux-gnu-libegl-mesa-so-0-undefined-symbol-wl-display-create-queue-with-name/124599)

<div class="topic-metadata">

**Author:** [@ForceBru](https://discourse.julialang.org/u/ForceBru)\
**Replies:** 3\
**Last updated:** [February 14, 2025, 1:47am UTC](https://discourse.julialang.org/t/gksqt-symbol-lookup-error-lib-x86-64-linux-gnu-libegl-mesa-so-0-undefined-symbol-wl-display-create-queue-with-name/124599 "2025-02-14T01:47:50Z")

</div>

I can’t show any plots from the terminal: (@v1.11) pkg\> activate --temp Activating new project at \`/tmp/jl\_qLK6Cw\` (jl\_qLK6Cw) pkg\> add Plots Resolving package versions... Updating \`/tmp/jl\_qLK6Cw/Project.toml…

---

## [When does @inbounds increase performance?](https://discourse.julialang.org/t/when-does-inbounds-increase-performance/123827)

<div class="topic-metadata">

**Author:** [@leespen1](https://discourse.julialang.org/u/leespen1)\
**Replies:** 14\
**Last updated:** [February 14, 2025, 1:00am UTC](https://discourse.julialang.org/t/when-does-inbounds-increase-performance/123827 "2025-02-14T01:00:44Z")

</div>

I am interested in making some optimizations in my software. I noticed many packages make use of the @inbounds macro, and the Julia manual mentions @inbounds in its performance tips section (Performance Tips · The Julia …

---

## [Discussion Towards: Incremental Coding/ Native Query Language in Julia](https://discourse.julialang.org/t/discussion-towards-incremental-coding-native-query-language-in-julia/125873)

<div class="topic-metadata">

**Author:** [@GeekyPeas](https://discourse.julialang.org/u/GeekyPeas)\
**Replies:** 5\
**Last updated:** [February 13, 2025, 8:38pm UTC](https://discourse.julialang.org/t/discussion-towards-incremental-coding-native-query-language-in-julia/125873 "2025-02-13T20:38:07Z")

</div>

WARNING: Visionary/ Feeling inspired. Call for advice, suggestions on how to proceed. Summary I imagine to be able to declare only the type of a variable and not assign it any value. This might be useful as It can act a…

---

## [Generically Wrapping Fortran Library](https://discourse.julialang.org/t/generically-wrapping-fortran-library/125877)

<div class="topic-metadata">

**Author:** [@ejmeitz](https://discourse.julialang.org/u/ejmeitz)\
**Replies:** 2\
**Last updated:** [February 13, 2025, 7:58pm UTC](https://discourse.julialang.org/t/generically-wrapping-fortran-library/125877 "2025-02-13T19:58:00Z")

</div>

I am interested in wrapping a Fortran library in Julia, but I find the name mangling a bit problematic for deploying to HPC environments where people may want to use a custom binary. The docs say: “so to call a Fortran …

---

## [Observable for holding any Univariate Distribution](https://discourse.julialang.org/t/observable-for-holding-any-univariate-distribution/125876)

<div class="topic-metadata">

**Author:** [@rand5](https://discourse.julialang.org/u/rand5)\
**Replies:** 1\
**Last updated:** [February 13, 2025, 7:19pm UTC](https://discourse.julialang.org/t/observable-for-holding-any-univariate-distribution/125876 "2025-02-13T19:19:48Z")

</div>

How would one create an Observable to hold any univariate distribution? If I do, using Interact, Distributions h = Observable(Normal()) The observable only accepts Normals, so the following fails: h\[\] = Gamma()

---

## [A brain-storm on precompiled Julia](https://discourse.julialang.org/t/a-brain-storm-on-precompiled-julia/125874)

<div class="topic-metadata">

**Author:** [@mpeters2](https://discourse.julialang.org/u/mpeters2)\
**Replies:** 1\
**Last updated:** [February 13, 2025, 6:29pm UTC](https://discourse.julialang.org/t/a-brain-storm-on-precompiled-julia/125874 "2025-02-13T18:29:05Z")

</div>

Decades ago, I had a card in my Apple \]\[+ called “Snapshot” (DarkStar Systems), that allowed you to “copy” (er, pirate) software by saving a snapshot of memory to disk. It’s the future: Let’s imagine that you have devel…

---

## [Julia Opencv memory leak](https://discourse.julialang.org/t/julia-opencv-memory-leak/125839)

<div class="topic-metadata">

**Author:** [@jcbritobr](https://discourse.julialang.org/u/jcbritobr)\
**Replies:** 8\
**Last updated:** [February 13, 2025, 6:11pm UTC](https://discourse.julialang.org/t/julia-opencv-memory-leak/125839 "2025-02-13T18:11:31Z")

</div>

Hello. Good afternoon. Im using OpenCV.jl and Im facing a memory leak using video capture in this example. May someone help? julia 1.11.3 Win x64 using OpenCV cap = OpenCV.VideoCapture(0) if !OpenCV.isOpene…

---

## [Setting axis properties in a Makie recipe](https://discourse.julialang.org/t/setting-axis-properties-in-a-makie-recipe/125863)

<div class="topic-metadata">

**Author:** [@prittjam](https://discourse.julialang.org/u/prittjam)\
**Replies:** 2\
**Last updated:** [February 13, 2025, 5:11pm UTC](https://discourse.julialang.org/t/setting-axis-properties-in-a-makie-recipe/125863 "2025-02-13T17:11:40Z")

</div>

I’ve spent a lot of time figuring out how to set axis properties in a Makie recipe. I’m convinced this is not possible. Is this the case?

---

## [Can this performance be improved?](https://discourse.julialang.org/t/can-this-performance-be-improved/125768)

<div class="topic-metadata">

**Author:** [@ilanggear](https://discourse.julialang.org/u/ilanggear)\
**Replies:** 10\
**Last updated:** [February 13, 2025, 5:05pm UTC](https://discourse.julialang.org/t/can-this-performance-be-improved/125768 "2025-02-13T17:05:59Z")

</div>

I have used ProfileView.@profview to generate the attached flame graph. I have read and re-read the documentation, but I’m still not confident of my interpretation, or whether there is something I can improve. The top l…

---

## [Can I run \`include("file")\` for a file stored in a loaded package](https://discourse.julialang.org/t/can-i-run-include-file-for-a-file-stored-in-a-loaded-package/125866)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 3\
**Last updated:** [February 13, 2025, 3:08pm UTC](https://discourse.julialang.org/t/can-i-run-include-file-for-a-file-stored-in-a-loaded-package/125866 "2025-02-13T15:08:34Z")

</div>

let’s say I have a package, which in its main directory contain a file “some\_file.jl”. if I run using MyPackage is it possible to somehow run include("MyPackage.some\_file.jl") I.e. run some file contained in the pack…

---

## [Help understand allocation in small custom struct](https://discourse.julialang.org/t/help-understand-allocation-in-small-custom-struct/125865)

<div class="topic-metadata">

**Author:** [@Giorgos\_Vretinaris](https://discourse.julialang.org/u/Giorgos_Vretinaris)\
**Replies:** 4\
**Last updated:** [February 13, 2025, 2:19pm UTC](https://discourse.julialang.org/t/help-understand-allocation-in-small-custom-struct/125865 "2025-02-13T14:19:05Z")

</div>

I have the following small custom structs that one of which is recursive in nature abstract type TTNNode{T} end struct LeafNode{T,A\<:AbstractMatrix{T}} \<: TTNNode{T} U::A # Basis matrix U\_ℓ ∈ ℝ^{n\_ℓ × r\_ℓ} …

---

## [StructArrays.jl getindex cost memory](https://discourse.julialang.org/t/structarrays-jl-getindex-cost-memory/125853)

<div class="topic-metadata">

**Author:** [@kongdd](https://discourse.julialang.org/u/kongdd)\
**Replies:** 4\
**Last updated:** [February 13, 2025, 10:12am UTC](https://discourse.julialang.org/t/structarrays-jl-getindex-cost-memory/125853 "2025-02-13T10:12:04Z")

</div>

using StructArrays using BenchmarkTools abstract type AbstractSoilParam{T} end @kwdef mutable struct ParamCampbell{T} \<: AbstractSoilParam{T} θ\_sat::T = 0.287 # \[m3 m-3\] # θ\_res::T = 0.075 # \[m3 m-3\] ψ\_…

---

## [Finally writing my chess engine!](https://discourse.julialang.org/t/finally-writing-my-chess-engine/125558)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 2\
**Last updated:** [February 13, 2025, 9:46am UTC](https://discourse.julialang.org/t/finally-writing-my-chess-engine/125558 "2025-02-13T09:46:55Z")

</div>

After trying to contribute to Stockfish, it’s time for me to try to build my own chess engine. This one won’t be UCI-compliant per se; it’s more like a library where you can add interfaces, etc later on. I plan to train …

---

## [Struggling to solve PowerSystems.Systems](https://discourse.julialang.org/t/struggling-to-solve-powersystems-systems/124570)

<div class="topic-metadata">

**Author:** [@Andrei](https://discourse.julialang.org/u/Andrei)\
**Replies:** 1\
**Last updated:** [February 12, 2025, 6:34pm UTC](https://discourse.julialang.org/t/struggling-to-solve-powersystems-systems/124570 "2025-02-12T18:34:38Z")

</div>

Hello, I’m new at Julia programming and currently I’m trying to familiarize myself with instruments to solve OPF and economic dispatch in Julia. I wrote this simple example Numerical data there is mostly random, since…

---

## [How to precompile Oxygen?](https://discourse.julialang.org/t/how-to-precompile-oxygen/125834)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 1\
**Last updated:** [February 12, 2025, 4:56pm UTC](https://discourse.julialang.org/t/how-to-precompile-oxygen/125834 "2025-02-12T16:56:10Z")

</div>

I am using the web server Oxygen.jl . I use it to call functions using json over http. I want to create a system image to avoid the high time-to-first-reply. My question: In the precompile script I want to start Oxygen…

---

## [Unable to install voronoifvm and pdelib](https://discourse.julialang.org/t/unable-to-install-voronoifvm-and-pdelib/125829)

<div class="topic-metadata">

**Author:** [@Sachin\_thorat](https://discourse.julialang.org/u/Sachin_thorat)\
**Replies:** 6\
**Last updated:** [February 12, 2025, 4:35pm UTC](https://discourse.julialang.org/t/unable-to-install-voronoifvm-and-pdelib/125829 "2025-02-12T16:35:46Z")

</div>

I tried installing IJulia package which has dependencies related to VoronoiFVM and PDELab packages. And these two packages are not getting installed. The error is mentioned in the code snippet provided below. OS: Linux …

---

## [How to trace the functions called by my script？](https://discourse.julialang.org/t/how-to-trace-the-functions-called-by-my-script/106975)

<div class="topic-metadata">

**Author:** [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Replies:** 6\
**Last updated:** [February 12, 2025, 11:21am UTC](https://discourse.julialang.org/t/how-to-trace-the-functions-called-by-my-script/106975 "2025-02-12T11:21:53Z")

</div>

Suppose I have a julia script, in which many functions are called. There might be even be nested calling. Namely, the main function calls function A, which calls function B, which in turn calls function C. How can get a…

---

## [Testing XML.Nodes for equality](https://discourse.julialang.org/t/testing-xml-nodes-for-equality/125800)

<div class="topic-metadata">

**Author:** [@TimG](https://discourse.julialang.org/u/TimG)\
**Replies:** 2\
**Last updated:** [February 12, 2025, 11:06am UTC](https://discourse.julialang.org/t/testing-xml-nodes-for-equality/125800 "2025-02-12T11:06:10Z")

</div>

I’m having trouble making the test for equality between XML.nodes work. XML.jl defines a nodes\_equal function to test for equality, but I can’t make it work reliably. For example, I have two XML.nodes called node and ne…

---

## [ArgMacros: How to use variables as defaults?](https://discourse.julialang.org/t/argmacros-how-to-use-variables-as-defaults/125717)

<div class="topic-metadata">

**Author:** [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Replies:** 3\
**Last updated:** [February 12, 2025, 10:34am UTC](https://discourse.julialang.org/t/argmacros-how-to-use-variables-as-defaults/125717 "2025-02-12T10:34:52Z")

</div>

How do you use variables within @tuplearguments of ArgMacros? #!/usr/bin/env julia const usage = "thisscript \[--val1=\<val1\>\] \[--val2=\<val2\>\]" const val2\_default = 9 args = @tuplearguments begin @helpusage Main.usage…

---

## [Issue with Saving FMU File in FMIExport.jl: "Cannot find a package where this file is stored"](https://discourse.julialang.org/t/issue-with-saving-fmu-file-in-fmiexport-jl-cannot-find-a-package-where-this-file-is-stored/120856)

<div class="topic-metadata">

**Author:** [@CurioMath](https://discourse.julialang.org/u/CurioMath)\
**Replies:** 3\
**Last updated:** [February 12, 2025, 10:26am UTC](https://discourse.julialang.org/t/issue-with-saving-fmu-file-in-fmiexport-jl-cannot-find-a-package-where-this-file-is-stored/120856 "2025-02-12T10:26:18Z")

</div>

Hello, I am trying to save the FMU file generated using the FMIExport package, as per the examples provided in the Manipulation folder. The following is the Julia code that I used from the example: using FMI using FMIE…

---

## [ProfileView (Cairo? Gtk4?) started using some odd font, but why?](https://discourse.julialang.org/t/profileview-cairo-gtk4-started-using-some-odd-font-but-why/125780)

<div class="topic-metadata">

**Author:** [@HanD](https://discourse.julialang.org/u/HanD)\
**Replies:** 14\
**Last updated:** [February 12, 2025, 8:10am UTC](https://discourse.julialang.org/t/profileview-cairo-gtk4-started-using-some-odd-font-but-why/125780 "2025-02-12T08:10:39Z")

</div>

I’v been using ProfileView.jl for some time now, with success. However, recently, the display changed, and the tooltips and various other displayed strings started using some font which doesn’t have regular ASCII charact…

---

## [Parameters Optimization with Optim](https://discourse.julialang.org/t/parameters-optimization-with-optim/125760)

<div class="topic-metadata">

**Author:** [@luke98](https://discourse.julialang.org/u/luke98)\
**Replies:** 4\
**Last updated:** [February 12, 2025, 6:57am UTC](https://discourse.julialang.org/t/parameters-optimization-with-optim/125760 "2025-02-12T06:57:45Z")

</div>

Hi Everyone, I have a model that is regulated by a set of parameters. I am trying to choose the parameters so that the model matches some moments that I get from the data. This is my code: lower\_bounds = \[0.0, 1e-2, …

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

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