# General Usage

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

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

**Page:** 212

---

## [What should go in module docstrings?](https://discourse.julialang.org/t/what-should-go-in-module-docstrings/108742)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 7\
**Last updated:** [January 13, 2024, 1:04am UTC](https://discourse.julialang.org/t/what-should-go-in-module-docstrings/108742 "2024-01-13T01:04:04Z")

</div>

Currently a community effort is adding docstrings for a lot of names, tracked by @stevengj in Missing docstrings for public/exported symbols · Issue #52725 · JuliaLang/julia · GitHub. For some ecosystem modules, the mod…

---

## [Package compiler app with two entry points](https://discourse.julialang.org/t/package-compiler-app-with-two-entry-points/108748)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 1\
**Last updated:** [January 12, 2024, 10:54pm UTC](https://discourse.julialang.org/t/package-compiler-app-with-two-entry-points/108748 "2024-01-12T22:54:38Z")

</div>

I have a file foo.jl with two functions. One is to review ods files, and then if they are all accepable the other is to summarize them. It would be easy to put this code in a module and then in principle I should be ab…

---

## [When does it make sense to post a new package to the Julia repository?](https://discourse.julialang.org/t/when-does-it-make-sense-to-post-a-new-package-to-the-julia-repository/108701)

<div class="topic-metadata">

**Author:** [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Replies:** 15\
**Last updated:** [January 12, 2024, 6:07pm UTC](https://discourse.julialang.org/t/when-does-it-make-sense-to-post-a-new-package-to-the-julia-repository/108701 "2024-01-12T18:07:05Z")

</div>

Say, I was wondering when does it make sense to register a new package with the Julia registry? I am developing a set of packages for my own research. Now the paper is not released yet and the development is still on-go…

---

## [How can I register a new version from a branch?](https://discourse.julialang.org/t/how-can-i-register-a-new-version-from-a-branch/108730)

<div class="topic-metadata">

**Author:** [@Tortar](https://discourse.julialang.org/u/Tortar)\
**Replies:** 2\
**Last updated:** [January 12, 2024, 6:05pm UTC](https://discourse.julialang.org/t/how-can-i-register-a-new-version-from-a-branch/108730 "2024-01-12T18:05:17Z")

</div>

I’d like to register a new patch version of a package from a branch (GitHub - JuliaDynamics/Agents.jl at fix-agents-again), which is a lot behind the main branch containing instead a new major release (not stable enough …

---

## [Indexing strings by Unicode code point instead of code unit?](https://discourse.julialang.org/t/indexing-strings-by-unicode-code-point-instead-of-code-unit/55248)

<div class="topic-metadata">

**Author:** [@johann-petrak](https://discourse.julialang.org/u/johann-petrak)\
**Replies:** 14\
**Last updated:** [January 12, 2024, 5:54pm UTC](https://discourse.julialang.org/t/indexing-strings-by-unicode-code-point-instead-of-code-unit/55248 "2024-01-12T17:54:44Z")

</div>

I am very new to Julia and would like to find out if I want to use it for implementing a library. For this, I need to deal with Unicode strings and especially offset ranges of substrings a lot. In this context, I would …

---

## [Efficiency of parsing ASCII vs. Unicode](https://discourse.julialang.org/t/efficiency-of-parsing-ascii-vs-unicode/108727)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 10\
**Last updated:** [January 12, 2024, 5:42pm UTC](https://discourse.julialang.org/t/efficiency-of-parsing-ascii-vs-unicode/108727 "2024-01-12T17:42:51Z")

</div>

What about performance implications for parsing ASCII text files? Consider the following function which checks if a file has an equal number of left brackets and right brackets: function file\_has\_balanced\_brackets(file)…

---

## [Union splitting not working in Julia 1.10?](https://discourse.julialang.org/t/union-splitting-not-working-in-julia-1-10/108710)

<div class="topic-metadata">

**Author:** [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Replies:** 7\
**Last updated:** [January 12, 2024, 4:20pm UTC](https://discourse.julialang.org/t/union-splitting-not-working-in-julia-1-10/108710 "2024-01-12T16:20:51Z")

</div>

I’m getting the following results under 1.10: julia\> using BenchmarkTools julia\> x = rand(10\_000); julia\> function badsum(x) s = 0 for t in x s += t end …

---

## [Debugging memory corruption in Julia code](https://discourse.julialang.org/t/debugging-memory-corruption-in-julia-code/108717)

<div class="topic-metadata">

**Author:** [@minetest2048](https://discourse.julialang.org/u/minetest2048)\
**Replies:** 2\
**Last updated:** [January 12, 2024, 3:48pm UTC](https://discourse.julialang.org/t/debugging-memory-corruption-in-julia-code/108717 "2024-01-12T15:48:37Z")

</div>

I have a complicated Julia code and for some inputs it crashes with all the memory corruption errors you can think of: segmentation fault munmap error corrupted double linked list malloc consolidate invalid chunk size u…

---

## [How do you round -0.1 and +0.1 to 0.0? not -0.0 and 0.0](https://discourse.julialang.org/t/how-do-you-round-0-1-and-0-1-to-0-0-not-0-0-and-0-0/108731)

<div class="topic-metadata">

**Author:** [@BMval](https://discourse.julialang.org/u/BMval)\
**Replies:** 3\
**Last updated:** [January 12, 2024, 3:12pm UTC](https://discourse.julialang.org/t/how-do-you-round-0-1-and-0-1-to-0-0-not-0-0-and-0-0/108731 "2024-01-12T15:12:54Z")

</div>

The function round.(\[0.1 ,-0.1\]) returns minus zeros and positive zero. Is there a way, that both will be just zero (positive). I have this issue, since later I use unique(\[-0.0,0.0\]), which give again two zeros: -0.0 …

---

## [How to obtain the result of a diff between 2 files in a loop?](https://discourse.julialang.org/t/how-to-obtain-the-result-of-a-diff-between-2-files-in-a-loop/23784)

<div class="topic-metadata">

**Author:** [@steph\_de\_paris](https://discourse.julialang.org/u/steph_de_paris)\
**Replies:** 14\
**Last updated:** [January 12, 2024, 2:09pm UTC](https://discourse.julialang.org/t/how-to-obtain-the-result-of-a-diff-between-2-files-in-a-loop/23784 "2024-01-12T14:09:29Z")

</div>

Hello, I would like to compare in a loop files and to obtain the result through an integer (1=OK, 0=FALSE). I use the following code: for n in 1:10 run(\`diff file\_a file\_b\`) end If the 2 files file\_a and file\_b ar…

---

## [Reduce allocations when extracting values from NamedTuples](https://discourse.julialang.org/t/reduce-allocations-when-extracting-values-from-namedtuples/108570)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 12\
**Last updated:** [January 12, 2024, 1:18pm UTC](https://discourse.julialang.org/t/reduce-allocations-when-extracting-values-from-namedtuples/108570 "2024-01-12T13:18:51Z")

</div>

Hello, I have a situation where I need to extract values from NamedTuples which are embedded within structs. Unfortunately, there are a lot of allocations, and it is not type stable. I have created a MWE below. mutable…

---

## [Reading binary data from a file](https://discourse.julialang.org/t/reading-binary-data-from-a-file/108695)

<div class="topic-metadata">

**Author:** [@MrBean](https://discourse.julialang.org/u/MrBean)\
**Replies:** 9\
**Last updated:** [January 12, 2024, 12:13pm UTC](https://discourse.julialang.org/t/reading-binary-data-from-a-file/108695 "2024-01-12T12:13:17Z")

</div>

Dear all, This is my first post and I am a baby user of Julia. I would like to read data from a file saved in binary format that comes from the sampler of an analytical instrument. The data is of a complex type and ac…

---

## [Documenter.jl: @repl generated output differs from REPL](https://discourse.julialang.org/t/documenter-jl-repl-generated-output-differs-from-repl/108713)

<div class="topic-metadata">

**Author:** [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Replies:** 0\
**Last updated:** [January 12, 2024, 12:54am UTC](https://discourse.julialang.org/t/documenter-jl-repl-generated-output-differs-from-repl/108713 "2024-01-12T00:54:27Z")

</div>

Let’s say I want to generate the REPL sequence julia\> f(x) = x f (generic function with 1 method) julia\> repr(f) "f" with a @repl block in Documenter.jl. If I write \`\`\`@repl f(x) = x repr(f) \`\`\` then I get the outpu…

---

## [Parametric type construction with Parameters.jl fails](https://discourse.julialang.org/t/parametric-type-construction-with-parameters-jl-fails/108712)

<div class="topic-metadata">

**Author:** [@apo383](https://discourse.julialang.org/u/apo383)\
**Replies:** 0\
**Last updated:** [January 12, 2024, 12:40am UTC](https://discourse.julialang.org/t/parametric-type-construction-with-parameters-jl-fails/108712 "2024-01-12T00:40:36Z")

</div>

I like how @with\_kw can construct new type instances based on an existing one, and was successful with it until I made my struct parametric. First, the non-parametric version: using Parameters abstract type SomeTypes en…

---

## [How to update function coefficients during run time](https://discourse.julialang.org/t/how-to-update-function-coefficients-during-run-time/108700)

<div class="topic-metadata">

**Author:** [@alex-s-gardner](https://discourse.julialang.org/u/alex-s-gardner)\
**Replies:** 2\
**Last updated:** [January 11, 2024, 7:52pm UTC](https://discourse.julialang.org/t/how-to-update-function-coefficients-during-run-time/108700 "2024-01-11T19:52:52Z")

</div>

I need to define a function: ddx(v) = ((v\[4\] + v\[6\]) / 2 - v\[5\]) / X.^ 2 where X is only known at run time and changes with each high level iteration of a loop. I’ve tried using @eval: @eval ddx(v) = ((v\[4\] + v\[6\]) /…

---

## [How to return all variable values of a non-simplified system of equations from a structurally-simplified solution output](https://discourse.julialang.org/t/how-to-return-all-variable-values-of-a-non-simplified-system-of-equations-from-a-structurally-simplified-solution-output/107915)

<div class="topic-metadata">

**Author:** [@chris-hampel-CA](https://discourse.julialang.org/u/chris-hampel-CA)\
**Replies:** 13\
**Last updated:** [January 11, 2024, 5:46pm UTC](https://discourse.julialang.org/t/how-to-return-all-variable-values-of-a-non-simplified-system-of-equations-from-a-structurally-simplified-solution-output/107915 "2024-01-11T17:46:00Z")

</div>

Hello, I am using MTK to solve a system of algebraic nonlinear equations. Using structural\_simplify() helps make these types of problems much easier to solve. However, I have noticed an inefficiency when trying to retu…

---

## [Mapslices and @threads](https://discourse.julialang.org/t/mapslices-and-threads/28138)

<div class="topic-metadata">

**Author:** [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Replies:** 4\
**Last updated:** [January 11, 2024, 4:57pm UTC](https://discourse.julialang.org/t/mapslices-and-threads/28138 "2024-01-11T16:57:17Z")

</div>

I am fooling around with 1.30-rc1 and would like to understand how to make a call on mapslices threaded. Since mapslices can emulate a loop over an array dimension, it would nice to make that “loop” Threads.@threads. Do…

---

## [Using and understanding multi-threading](https://discourse.julialang.org/t/using-and-understanding-multi-threading/108682)

<div class="topic-metadata">

**Author:** [@Andrea\_Vigliotti](https://discourse.julialang.org/u/Andrea_Vigliotti)\
**Replies:** 1\
**Last updated:** [January 11, 2024, 2:01pm UTC](https://discourse.julialang.org/t/using-and-understanding-multi-threading/108682 "2024-01-11T14:01:30Z")

</div>

so, I am trying to understand how multi threading works, I started julia as julia -t 16 on a 32 cores node where I reserved 8, then I run the example from the documentation here these are the lines function sum\_single(a…

---

## [Using Polyester.jl with ChunkSplitters.jl](https://discourse.julialang.org/t/using-polyester-jl-with-chunksplitters-jl/108528)

<div class="topic-metadata">

**Author:** [@Bruno\_Amorim](https://discourse.julialang.org/u/Bruno_Amorim)\
**Replies:** 4\
**Last updated:** [January 11, 2024, 1:33pm UTC](https://discourse.julialang.org/t/using-polyester-jl-with-chunksplitters-jl/108528 "2024-01-11T13:33:46Z")

</div>

I am trying to paralelize a function, where I have some quantity a that I split in chunks and paralelize over the differente chunks. After that I combine the results obtained from all chunks. An example of this would be …

---

## [Substantial increase in time in copying an instantiated broadcasted object vs a non-instantiated one](https://discourse.julialang.org/t/substantial-increase-in-time-in-copying-an-instantiated-broadcasted-object-vs-a-non-instantiated-one/108673)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 2\
**Last updated:** [January 11, 2024, 11:49am UTC](https://discourse.julialang.org/t/substantial-increase-in-time-in-copying-an-instantiated-broadcasted-object-vs-a-non-instantiated-one/108673 "2024-01-11T11:49:58Z")

</div>

I’m trying to understand the difference in performance here: julia\> using LinearAlgebra julia\> n=40; U = UpperTriangular(rand(n,n)); C = similar(U); B = Broadcast.broadcasted(\*, 2.0, U); julia\> @btime copyto!($C, $B);…

---

## [Julia crashing with jfptr\_task\_done\_hook\_75249.1](https://discourse.julialang.org/t/julia-crashing-with-jfptr-task-done-hook-75249-1/108676)

<div class="topic-metadata">

**Author:** [@eveningsilverfox](https://discourse.julialang.org/u/eveningsilverfox)\
**Replies:** 1\
**Last updated:** [January 11, 2024, 11:35am UTC](https://discourse.julialang.org/t/julia-crashing-with-jfptr-task-done-hook-75249-1/108676 "2024-01-11T11:35:54Z")

</div>

My julia code is crashing with the following error. RAM usage stays at a low value throughout, around 6/64GB. jfptr\_task\_done\_hook\_75249.1 at /home/aritra/julia-1.10.0/lib/julia/sys.so (unknown line) \_jl\_invoke at /cac…

---

## [Setting up worker local buffers when using Distributed.jl](https://discourse.julialang.org/t/setting-up-worker-local-buffers-when-using-distributed-jl/108671)

<div class="topic-metadata">

**Author:** [@RomeoV](https://discourse.julialang.org/u/RomeoV)\
**Replies:** 2\
**Last updated:** [January 11, 2024, 11:20am UTC](https://discourse.julialang.org/t/setting-up-worker-local-buffers-when-using-distributed-jl/108671 "2024-01-11T11:20:10Z")

</div>

Hello all, I am in the process of incrementally optimizing an algorithm, having focused first on single-core performance, then threading, and now want to scale to Distributed workers. One key element of my optimization…

---

## [Sampling (no inference) from a mixture model (compound probability distribution)](https://discourse.julialang.org/t/sampling-no-inference-from-a-mixture-model-compound-probability-distribution/108637)

<div class="topic-metadata">

**Author:** [@adomasbaliuka](https://discourse.julialang.org/u/adomasbaliuka)\
**Replies:** 3\
**Last updated:** [January 11, 2024, 10:09am UTC](https://discourse.julialang.org/t/sampling-no-inference-from-a-mixture-model-compound-probability-distribution/108637 "2024-01-11T10:09:15Z")

</div>

I’ve never used Turing before and don’t have a lot of statistics knowledge but I’d love to be able to do this kind of thing anyway: I don’t have any data. I only want to compute the expectation value of a somewhat compl…

---

## [Function specialization in Printf](https://discourse.julialang.org/t/function-specialization-in-printf/108611)

<div class="topic-metadata">

**Author:** [@jsjie](https://discourse.julialang.org/u/jsjie)\
**Replies:** 2\
**Last updated:** [January 11, 2024, 2:15am UTC](https://discourse.julialang.org/t/function-specialization-in-printf/108611 "2024-01-11T02:15:09Z")

</div>

My code, after compiled with PackageCompiler, show some memory allocation in logging functions. With the help of --trace-compile, I’ve found that when the compiled binary is running, the following functions are precompil…

---

## [\_set\_value!(w, key, val) = w\[key\] = val](https://discourse.julialang.org/t/set-value-w-key-val-w-key-val/108656)

<div class="topic-metadata">

**Author:** [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Replies:** 2\
**Last updated:** [January 11, 2024, 4:52am UTC](https://discourse.julialang.org/t/set-value-w-key-val-w-key-val/108656 "2024-01-11T04:52:02Z")

</div>

Is this equivalent to the function function \_set\_value!(w, key, val) w\[key\] = val end

---

## [Poor Distributed performance for independent linear algebra operators](https://discourse.julialang.org/t/poor-distributed-performance-for-independent-linear-algebra-operators/108480)

<div class="topic-metadata">

**Author:** [@hshackle](https://discourse.julialang.org/u/hshackle)\
**Replies:** 9\
**Last updated:** [January 10, 2024, 9:29pm UTC](https://discourse.julialang.org/t/poor-distributed-performance-for-independent-linear-algebra-operators/108480 "2024-01-10T21:29:05Z")

</div>

I’m trying to run some embarrasingly parallel code using Distributed but am seeing poor scaling when scaling up the number of cores. The actual code is rather complicated but for the most part just involves a lot of line…

---

## [What does 'using ..SomeMudule' mean?](https://discourse.julialang.org/t/what-does-using-somemudule-mean/108655)

<div class="topic-metadata">

**Author:** [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Replies:** 1\
**Last updated:** [January 11, 2024, 2:47am UTC](https://discourse.julialang.org/t/what-does-using-somemudule-mean/108655 "2024-01-11T02:47:49Z")

</div>

What does the two dots mean? I guess it is path relevant.

---

## [Automatic keyword argument constructor](https://discourse.julialang.org/t/automatic-keyword-argument-constructor/36573)

<div class="topic-metadata">

**Author:** [@HugoTrentesaux](https://discourse.julialang.org/u/HugoTrentesaux)\
**Replies:** 9\
**Last updated:** [January 11, 2024, 1:57am UTC](https://discourse.julialang.org/t/automatic-keyword-argument-constructor/36573 "2024-01-11T01:57:06Z")

</div>

Is there a way to have Julia automatically defining a constructor using keywords arguments? # the composite type struct Person name::String age::Int end # generates automatically this constructor: me = Person("Hugo"…

---

## [Efficient Minors of a Toeplitz Matrix - Is There Demand?](https://discourse.julialang.org/t/efficient-minors-of-a-toeplitz-matrix-is-there-demand/108318)

<div class="topic-metadata">

**Author:** [@bremez](https://discourse.julialang.org/u/bremez)\
**Replies:** 6\
**Last updated:** [January 10, 2024, 8:27pm UTC](https://discourse.julialang.org/t/efficient-minors-of-a-toeplitz-matrix-is-there-demand/108318 "2024-01-10T20:27:34Z")

</div>

I have had a use case there I need (the FFT of) the sequence of the primary minors of a square matrix A, e.g. schematically fft(\[det(A\[1:m, 1:m\] for m in 1:size(A,1)\]). One would expect naively that this is O(n^4) in the…

---

## [Error from closure definition inside @batch](https://discourse.julialang.org/t/error-from-closure-definition-inside-batch/108631)

<div class="topic-metadata">

**Author:** [@svretina](https://discourse.julialang.org/u/svretina)\
**Replies:** 2\
**Last updated:** [January 10, 2024, 4:50pm UTC](https://discourse.julialang.org/t/error-from-closure-definition-inside-batch/108631 "2024-01-10T16:50:22Z")

</div>

I am trying to use the @batch from Polyester.jl as an alternative to the Base.Threads.@threads but inside my loops I need to define some closures which produced an UndefVarError. A MWE is the following function func() …

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

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