# Internals & Design

**URL:** https://discourse.julialang.org/c/dev/5.md?page=22

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

**Page:** 23

---

## [Why are scalars iterable when broadcasting would still work fine if they weren't?](https://discourse.julialang.org/t/why-are-scalars-iterable-when-broadcasting-would-still-work-fine-if-they-werent/84785)

<div class="topic-metadata">

**Author:** [@Jollywatt](https://discourse.julialang.org/u/Jollywatt)\
**Replies:** 2\
**Last updated:** [July 26, 2022, 3:24am UTC](https://discourse.julialang.org/t/why-are-scalars-iterable-when-broadcasting-would-still-work-fine-if-they-werent/84785 "2022-07-26T03:24:11Z")

</div>

This is a soft-question about an aspect of Julia’s design and history. It’s a well-discussed point that scalars are iterable, in the sense that: julia\> 42\[1\], 42\[\], size(42), length(42) (42, 42, (), 1) julia\> collect(…

---

## [What is harder about saving a Julia session via the REPL whenever?](https://discourse.julialang.org/t/what-is-harder-about-saving-a-julia-session-via-the-repl-whenever/82897)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 10\
**Last updated:** [July 26, 2022, 3:05am UTC](https://discourse.julialang.org/t/what-is-harder-about-saving-a-julia-session-via-the-repl-whenever/82897 "2022-07-26T03:05:13Z")

</div>

I’m learning PackageCompiler.jl, and I’m wondering why creating a sysimage requires an input of packages, the project/environment, and precompile scripts. I do appreciate the paper trail, but couldn’t a sysimage be creat…

---

## [Push! to reshape-d vector unshares data with parent array](https://discourse.julialang.org/t/push-to-reshape-d-vector-unshares-data-with-parent-array/84664)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 9\
**Last updated:** [July 24, 2022, 12:45pm UTC](https://discourse.julialang.org/t/push-to-reshape-d-vector-unshares-data-with-parent-array/84664 "2022-07-24T12:45:57Z")

</div>

Minimal example below. Pushing to a reshaped vector y seems to allocate a copy of the original matrix x so that they no longer share data, but it’s strange because it doesn’t seem to reassign y, which would print a warni…

---

## [Binary Caching and Pre-compilation .. again](https://discourse.julialang.org/t/binary-caching-and-pre-compilation-again/19589)

<div class="topic-metadata">

**Author:** [@TsurHerman](https://discourse.julialang.org/u/TsurHerman)\
**Replies:** 7\
**Last updated:** [July 22, 2022, 3:31am UTC](https://discourse.julialang.org/t/binary-caching-and-pre-compilation-again/19589 "2022-07-22T03:31:35Z")

</div>

I want to present here again and perhaps more clearly, the concept of context dispatch , or more precisely resolving multiple dispatch based on some context. I believe this can contribute to precompilation and load time…

---

## [Is there anything users can do to help move Apple Silicon support from Tier 3 to Tier 1?](https://discourse.julialang.org/t/is-there-anything-users-can-do-to-help-move-apple-silicon-support-from-tier-3-to-tier-1/72739)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 33\
**Last updated:** [July 19, 2022, 10:17pm UTC](https://discourse.julialang.org/t/is-there-anything-users-can-do-to-help-move-apple-silicon-support-from-tier-3-to-tier-1/72739 "2022-07-19T22:17:34Z")

</div>

Is there anything users can do to help move Apple Silicon support from Tier 3 to Tier 1? Given that most new Mac machines now have an M1 chip, it seems like there will be more and more Julia programmers wanting to use a …

---

## [Dealing with external libraries that don't restore old signal handlers](https://discourse.julialang.org/t/dealing-with-external-libraries-that-dont-restore-old-signal-handlers/84343)

<div class="topic-metadata">

**Author:** [@sobhan](https://discourse.julialang.org/u/sobhan)\
**Replies:** 7\
**Last updated:** [July 17, 2022, 5:54pm UTC](https://discourse.julialang.org/t/dealing-with-external-libraries-that-dont-restore-old-signal-handlers/84343 "2022-07-17T17:54:03Z")

</div>

TLDR: if the code is segfaulting outside Ccalls AFTER Ccalls in threaded GC, it might be that the C library has loaded a custom signal handler and is competing with julia’s handler. The solution is something like """ s…

---

## [The role of femtolisp in Julia?](https://discourse.julialang.org/t/the-role-of-femtolisp-in-julia/1902)

<div class="topic-metadata">

**Author:** [@abhi18av](https://discourse.julialang.org/u/abhi18av)\
**Replies:** 40\
**Last updated:** [July 11, 2022, 8:25pm UTC](https://discourse.julialang.org/t/the-role-of-femtolisp-in-julia/1902 "2022-07-11T20:25:44Z")

</div>

Hii Julians, I was wondering about the exact usage of femtolisp in julia. I’ve Googled around but the nothing exact came up, though there were some references in the old archives. I know that the julia-parser has a nat…

---

## [Why is it possible to change the values of a row of a given matrix with a new matrix?](https://discourse.julialang.org/t/why-is-it-possible-to-change-the-values-of-a-row-of-a-given-matrix-with-a-new-matrix/84322)

<div class="topic-metadata">

**Author:** [@Shayan](https://discourse.julialang.org/u/Shayan)\
**Replies:** 2\
**Last updated:** [July 16, 2022, 7:25pm UTC](https://discourse.julialang.org/t/why-is-it-possible-to-change-the-values-of-a-row-of-a-given-matrix-with-a-new-matrix/84322 "2022-07-16T19:25:34Z")

</div>

I tried to pick an exact and explicit title for this question but failed. So I guess you must read my entire question to understand the issue. In Julia, we can define a random 2\*5 Matrix using rand(2,5): julia\> a = ran…

---

## [Standard interface definitions for Julia?](https://discourse.julialang.org/t/standard-interface-definitions-for-julia/82181)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 12\
**Last updated:** [July 16, 2022, 6:43am UTC](https://discourse.julialang.org/t/standard-interface-definitions-for-julia/82181 "2022-07-16T06:43:39Z")

</div>

I think a standard way to define interfaces in Julia, combined with a standard way to test if type satisfies all interfaces that are defined on it would be useful to improve the quality and reliability of the Julia packa…

---

## [How does the compiler know not to constant-fold methods like rand?](https://discourse.julialang.org/t/how-does-the-compiler-know-not-to-constant-fold-methods-like-rand/84092)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 2\
**Last updated:** [July 12, 2022, 10:15am UTC](https://discourse.julialang.org/t/how-does-the-compiler-know-not-to-constant-fold-methods-like-rand/84092 "2022-07-12T10:15:53Z")

</div>

It seems like for the most part, the compiler tries very hard to compute constant expressions at compile-time, though I’ve seen it give up on loops. But there are situations where it sensibly doesn’t even try, like rand(…

---

## [Embedding Julia in the Java Virtual Machine](https://discourse.julialang.org/t/embedding-julia-in-the-java-virtual-machine/51444)

<div class="topic-metadata">

**Author:** [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Replies:** 11\
**Last updated:** [October 5, 2021, 1:55pm UTC](https://discourse.julialang.org/t/embedding-julia-in-the-java-virtual-machine/51444 "2021-10-05T13:55:06Z")

</div>

Is it easier to embed Julia into the Java Virtual Machine (JVM) or easier to embed the JVM into Julia? Embedding the JVM into Julia I’ve been working with @avik on JavaCall.jl for the better part of this year. To make …

---

## [\[Parser\] Allow comma between struct fields and at the end of exported object list](https://discourse.julialang.org/t/parser-allow-comma-between-struct-fields-and-at-the-end-of-exported-object-list/84049)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 0\
**Last updated:** [July 11, 2022, 1:26pm UTC](https://discourse.julialang.org/t/parser-allow-comma-between-struct-fields-and-at-the-end-of-exported-object-list/84049 "2022-07-11T13:26:52Z")

</div>

I have a cup of minor issues that bother me from time to time. The first one is that it is currently an error to have a comma between struct fields, e.g. this is an error: struct Foo a::Int64, b::Int64 end The…

---

## [OffsetArrays, inbounds, and confusion](https://discourse.julialang.org/t/offsetarrays-inbounds-and-confusion/81295)

<div class="topic-metadata">

**Author:** [@fft](https://discourse.julialang.org/u/fft)\
**Replies:** 53\
**Last updated:** [July 10, 2022, 7:27am UTC](https://discourse.julialang.org/t/offsetarrays-inbounds-and-confusion/81295 "2022-07-10T07:27:50Z")

</div>

There has been quite a bit of activity around the Yuri Vishnevsky article. Thought I would but some of my thoughts here as someone who is fairly new to Julia and heavily uses C++ and python professionally. As others hav…

---

## [Lacking documentation about non-types as type parameters](https://discourse.julialang.org/t/lacking-documentation-about-non-types-as-type-parameters/83893)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 0\
**Last updated:** [July 7, 2022, 1:31pm UTC](https://discourse.julialang.org/t/lacking-documentation-about-non-types-as-type-parameters/83893 "2022-07-07T13:31:24Z")

</div>

Type parameters can be non-types that are isbits (see 3rd bullet point in Types · The Julia Language): julia\> struct A{T} end julia\> A{1.2} A{1.2} julia\> A{'a'} A{'a'} julia\> A{π} A{π} julia\> A{1//2} A{1//2} julia\> …

---

## [Does \`AbstractArray\` itself need to support indexing beyond 1-based?](https://discourse.julialang.org/t/does-abstractarray-itself-need-to-support-indexing-beyond-1-based/83324)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 15\
**Last updated:** [July 5, 2022, 11:48pm UTC](https://discourse.julialang.org/t/does-abstractarray-itself-need-to-support-indexing-beyond-1-based/83324 "2022-07-05T23:48:24Z")

</div>

I was thinking about the thread (partially) about the incompatibility of some existing AbstractArray methods with OffsetArrays, and it got me wondering why AbstractArray was extended beyond 1-based indexing. Sticking to …

---

## [How to iterate all block statements in IRCode?](https://discourse.julialang.org/t/how-to-iterate-all-block-statements-in-ircode/83701)

<div class="topic-metadata">

**Author:** [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Replies:** 5\
**Last updated:** [July 4, 2022, 6:29am UTC](https://discourse.julialang.org/t/how-to-iterate-all-block-statements-in-ircode/83701 "2022-07-04T06:29:27Z")

</div>

Say, I have an instance of IRCode like this: 7 1 ─ %1 = Main.bar(\_2)::Tuple{Float64, Float64} │ │ %2 = Base.indexed\_iterate(%1, 1)::PartialStruct(Tuple{Float64, Int64}, Any\[Float…

---

## [Is \* a ternary/quarternary operator in 1.7+, or am I missing something that was there before?](https://discourse.julialang.org/t/is-a-ternary-quarternary-operator-in-1-7-or-am-i-missing-something-that-was-there-before/83714)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 4\
**Last updated:** [July 4, 2022, 2:10am UTC](https://discourse.julialang.org/t/is-a-ternary-quarternary-operator-in-1-7-or-am-i-missing-something-that-was-there-before/83714 "2022-07-04T02:10:34Z")

</div>

So I noticed this bit in matmul.jl # Three-argument \* """ \*(A, B::AbstractMatrix, C) A \* B \* C \* D Chained multiplication of 3 or 4 matrices is done in the most efficient sequence, based on the sizes of the arra…

---

## [Benchmarking Dict against C++ std::unordered\_map](https://discourse.julialang.org/t/benchmarking-dict-against-c-std-unordered-map/83669)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 6\
**Last updated:** [July 3, 2022, 11:27pm UTC](https://discourse.julialang.org/t/benchmarking-dict-against-c-std-unordered-map/83669 "2022-07-03T23:27:12Z")

</div>

I benchmarked Julia’s dictionary insertion and deletion with the following code, function test\_julia\_dict(n::Int64) m = Dict{Int, Int}() for i = 1:n m\[5\*i\] = i end for i = 1:n-1 delete!(m…

---

## [What is the programmatic way to obtain the path to the base directory?](https://discourse.julialang.org/t/what-is-the-programmatic-way-to-obtain-the-path-to-the-base-directory/83687)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 0\
**Last updated:** [July 3, 2022, 6:01am UTC](https://discourse.julialang.org/t/what-is-the-programmatic-way-to-obtain-the-path-to-the-base-directory/83687 "2022-07-03T06:01:54Z")

</div>

On v1.7, using a downloaded binary, joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "base") returns the path to the base directory. On v1.9, however, this has changed, and now julia\> joinpath(Sys.BINDIR, Base.DATAROOT…

---

## [An easy way to access files/folders/directories with Julia in command line based on language: batch-script](https://discourse.julialang.org/t/an-easy-way-to-access-files-folders-directories-with-julia-in-command-line-based-on-language-batch-script/79873)

<div class="topic-metadata">

**Author:** [@anon29721930](https://discourse.julialang.org/u/anon29721930)\
**Replies:** 14\
**Last updated:** [July 2, 2022, 2:57am UTC](https://discourse.julialang.org/t/an-easy-way-to-access-files-folders-directories-with-julia-in-command-line-based-on-language-batch-script/79873 "2022-07-02T02:57:13Z")

</div>

Hi all! Community Julia! user stories I would like as a user to list files, folders, directories like I would in shell script or bat-script in the Julia programming language, because it would be an easy way I would lik…

---

## [Develop julia base/\* vs usr/share/julia/src/base/\*](https://discourse.julialang.org/t/develop-julia-base-vs-usr-share-julia-src-base/82643)

<div class="topic-metadata">

**Author:** [@albheim](https://discourse.julialang.org/u/albheim)\
**Replies:** 9\
**Last updated:** [July 1, 2022, 11:27am UTC](https://discourse.julialang.org/t/develop-julia-base-vs-usr-share-julia-src-base/82643 "2022-07-01T11:27:21Z")

</div>

I had cloned and built julia, and was playing around with some things in base/\*, using Revise.track(Base), and seeing the changes in the REPL as I made them in the files. I restart julia and try to run things again, thou…

---

## [\`fill\` is dangerous :-(](https://discourse.julialang.org/t/fill-is-dangerous/83396)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 1\
**Last updated:** [June 27, 2022, 11:52am UTC](https://discourse.julialang.org/t/fill-is-dangerous/83396 "2022-06-27T11:52:20Z")

</div>

I propose to add an extra keyword argument to fill (and fill!) to specify copy instead of reference and switch to copy in Julia 2.0 :slight\_smile: While it makes sense to have call by sharing in functions, there is not …

---

## [Why throw on overlong slice?](https://discourse.julialang.org/t/why-throw-on-overlong-slice/83345)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 7\
**Last updated:** [June 26, 2022, 11:29pm UTC](https://discourse.julialang.org/t/why-throw-on-overlong-slice/83345 "2022-06-26T23:29:22Z")

</div>

Python: In \[1\]: \[1,2\]\[0:4\] Out\[1\]: \[1, 2\] Julia: julia\> \[1,2\]\[1:5\] ERROR: BoundsError: attempt to access 2-element Vector{Int64} at index \[1:5\] Why does Julia throw on overlong slice? Is this somehow useful for perfo…

---

## [FFTW MKL sub dimensional FFT create plan failed](https://discourse.julialang.org/t/fftw-mkl-sub-dimensional-fft-create-plan-failed/81086)

<div class="topic-metadata">

**Author:** [@Lightup1](https://discourse.julialang.org/u/Lightup1)\
**Replies:** 3\
**Last updated:** [June 25, 2022, 7:23am UTC](https://discourse.julialang.org/t/fftw-mkl-sub-dimensional-fft-create-plan-failed/81086 "2022-06-25T07:23:31Z")

</div>

MKL provider failed for plan sub dimension FFT. test=Array{ComplexF64}(undef, \[\[4,4\];\[4,4\]\]...); p1=plan\_fft(test,\[3,4\]) result1=fft(reshape(\[1:4^4;\],4,4,4,4)) result2=p1\*reshape(\[1:4^4;\],4,4,4,4) result1==result2 #fals…

---

## [How are invalidated MethodInstances found, and how well does the process scale?](https://discourse.julialang.org/t/how-are-invalidated-methodinstances-found-and-how-well-does-the-process-scale/83099)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 7\
**Last updated:** [June 22, 2022, 7:54am UTC](https://discourse.julialang.org/t/how-are-invalidated-methodinstances-found-and-how-well-does-the-process-scale/83099 "2022-06-22T07:54:52Z")

</div>

From what I understand, compiled methods (for clarity I’ll call them MethodInstances) are invalidated when methods are defined, e.g. f(x) = 1; f(1); f(x::Real) = 2. I imagine the most wasteful algorithm would be to check…

---

## [Different Errors on CI and local machine](https://discourse.julialang.org/t/different-errors-on-ci-and-local-machine/83120)

<div class="topic-metadata">

**Author:** [@fbanning](https://discourse.julialang.org/u/fbanning)\
**Replies:** 3\
**Last updated:** [June 22, 2022, 6:22am UTC](https://discourse.julialang.org/t/different-errors-on-ci-and-local-machine/83120 "2022-06-22T06:22:13Z")

</div>

I’m encountering an issue with CI on github. If I define julia\> foo(x) = nothing foo (generic function with 1 method) and do a @test\_throws with it, I would expect it to throw a MethodError like here julia\> foo(; x =…

---

## [Colorized objects when tab completing module](https://discourse.julialang.org/t/colorized-objects-when-tab-completing-module/83160)

<div class="topic-metadata">

**Author:** [@mwhisena](https://discourse.julialang.org/u/mwhisena)\
**Replies:** 0\
**Last updated:** [June 22, 2022, 4:41am UTC](https://discourse.julialang.org/t/colorized-objects-when-tab-completing-module/83160 "2022-06-22T04:41:51Z")

</div>

I think that it would be useful if Julia colorized the results when tab completing in the REPL. For instance, in the package Flux.jl one can simply do in REPL Flux. and then TAB to view all objects that were loaded fro…

---

## [Consistency between \`keys\`, \`values\`, and \`getindex\` for \`Pair\` type](https://discourse.julialang.org/t/consistency-between-keys-values-and-getindex-for-pair-type/83088)

<div class="topic-metadata">

**Author:** [@goretkin](https://discourse.julialang.org/u/goretkin)\
**Replies:** 1\
**Last updated:** [June 20, 2022, 7:25pm UTC](https://discourse.julialang.org/t/consistency-between-keys-values-and-getindex-for-pair-type/83088 "2022-06-20T19:25:39Z")

</div>

Consider julia\> nt = (;a = 10, b = 20) (a = 10, b = 20) julia\> \[(;k, v) for (k, v) in pairs(nt)\] 2-element Vector{NamedTuple{(:k, :v), Tuple{Symbol, Int64}}}: (k = :a, v = 10) (k = :b, v = 20) The above suggests tha…

---

## [Using the type and functions for dispatch purposes without loading all codes of its owner package](https://discourse.julialang.org/t/using-the-type-and-functions-for-dispatch-purposes-without-loading-all-codes-of-its-owner-package/79951)

<div class="topic-metadata">

**Author:** [@JohnnyChen94](https://discourse.julialang.org/u/JohnnyChen94)\
**Replies:** 9\
**Last updated:** [June 20, 2022, 8:25am UTC](https://discourse.julialang.org/t/using-the-type-and-functions-for-dispatch-purposes-without-loading-all-codes-of-its-owner-package/79951 "2022-06-20T08:25:37Z")

</div>

Like C/C++'s header file, I’m wondering if it’s possible for Julia to introduce similar concepts so that package authors can have a smaller dependencies and thus reduce the latency. In valid Julia semantics, this can be…

---

## [Why is the expression \`@foo.x\` parsed as \`macrocall . foo @x\` and not \`macrocall @foo .x\`?](https://discourse.julialang.org/t/why-is-the-expression-foo-x-parsed-as-macrocall-foo-x-and-not-macrocall-foo-x/82218)

<div class="topic-metadata">

**Author:** [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)\
**Replies:** 4\
**Last updated:** [June 19, 2022, 4:46pm UTC](https://discourse.julialang.org/t/why-is-the-expression-foo-x-parsed-as-macrocall-foo-x-and-not-macrocall-foo-x/82218 "2022-06-19T16:46:00Z")

</div>

I know Julia is not at that stage anymore, but i’m curious to know. And just to clarify the macrocall @foo .x, expression, i mean: Expr head: Symbol macrocall args: Array{Any}((2,)) 1: Symbol @foo 2: Expr …

[Previous page](https://discourse.julialang.org/c/dev/5.md?page=21)

[Next page](https://discourse.julialang.org/c/dev/5.md?page=23)
