# General Usage

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

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

**Page:** 1072

---

## [Help with solving a world age error in package on julia master](https://discourse.julialang.org/t/help-with-solving-a-world-age-error-in-package-on-julia-master/1126)

<div class="topic-metadata">

**Author:** [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Replies:** 11\
**Last updated:** [December 30, 2016, 1:50pm UTC](https://discourse.julialang.org/t/help-with-solving-a-world-age-error-in-package-on-julia-master/1126 "2016-12-30T13:50:41Z")

</div>

My package https://github.com/KristofferC/OhMyREPL.jl started failing on master with the error. julia\> WARNING: Caught an exception in the keymap: ERROR: MethodError: no method matching (::OhMyREPL.Prompt.##1#28)(::Base…

---

## [Service Registry for Julia](https://discourse.julialang.org/t/service-registry-for-julia/1214)

<div class="topic-metadata">

**Author:** [@Frank\_Langel](https://discourse.julialang.org/u/Frank_Langel)\
**Replies:** 0\
**Last updated:** [December 30, 2016, 8:44am UTC](https://discourse.julialang.org/t/service-registry-for-julia/1214 "2016-12-30T08:44:35Z")

</div>

Hi, the overall goal is build large application using Julia. Modularization is very important, and we would like to use a service registry for this: “The service registry is a database populated with information on how…

---

## [C and bits types confusion](https://discourse.julialang.org/t/c-and-bits-types-confusion/1168)

<div class="topic-metadata">

**Author:** [@barche](https://discourse.julialang.org/u/barche)\
**Replies:** 11\
**Last updated:** [December 30, 2016, 10:45am UTC](https://discourse.julialang.org/t/c-and-bits-types-confusion/1168 "2016-12-30T10:45:49Z")

</div>

Hi, I’m trying a direct conversion using a bits type, but it seems to go wrong. C side: struct BitsClass { double a; double b; }; BitsClass make\_bits(double a, double b) { return {a,b}; } double get\_a(BitsClass c)…

---

## [Work around invariance](https://discourse.julialang.org/t/work-around-invariance/1205)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 7\
**Last updated:** [December 30, 2016, 9:32am UTC](https://discourse.julialang.org/t/work-around-invariance/1205 "2016-12-30T09:32:56Z")

</div>

I am working with a family of models, which have certain properties, lets call them statenames and obsnames. Many of these are shared between models, so it would be nice to reuse them. Models are mapped to types in my co…

---

## [How to define outer constructor based on array size?](https://discourse.julialang.org/t/how-to-define-outer-constructor-based-on-array-size/1193)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 6\
**Last updated:** [December 30, 2016, 5:24am UTC](https://discourse.julialang.org/t/how-to-define-outer-constructor-based-on-array-size/1193 "2016-12-30T05:24:24Z")

</div>

Consider the parametric type below: immutable Foo{N} A::AbstractMatrix{Float64} b::AbstractVector{Float64} Foo(A,b) = size(A) == (N,length(b)) ? new(A,b) : error("incorrect size") end Because I defined the inner…

---

## [Problem building LLVM in master today](https://discourse.julialang.org/t/problem-building-llvm-in-master-today/1211)

<div class="topic-metadata">

**Author:** [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Replies:** 2\
**Last updated:** [December 30, 2016, 4:14am UTC](https://discourse.julialang.org/t/problem-building-llvm-in-master-today/1211 "2016-12-30T04:14:05Z")

</div>

I tried to rebuild Julia this evening, from the very latest master, and ran into the following problem: \[ 71%\] Building CXX object lib/ExecutionEngine/Orc/CMakeFiles/LLVMOrcJIT.dir/OrcRemoteTargetRPCAPI.cpp.o In file …

---

## [Base.Cartesian's @nloops with @simd](https://discourse.julialang.org/t/base-cartesians-nloops-with-simd/1153)

<div class="topic-metadata">

**Author:** [@robertdj](https://discourse.julialang.org/u/robertdj)\
**Replies:** 6\
**Last updated:** [December 29, 2016, 9:25pm UTC](https://discourse.julialang.org/t/base-cartesians-nloops-with-simd/1153 "2016-12-29T21:25:52Z")

</div>

The first example on how to use @nloops in the Base.Cartesian documentation is the following: using Base.Cartesian A = rand(3,3) s = 0.0 @nloops 2 i A begin s += @nref 2 A i end The loop is expanded to for i\_2 = 1:s…

---

## [KeyError: \_\_array\_interface\_\_ not found when using PyCall](https://discourse.julialang.org/t/keyerror---array-interface---not-found-when-using-pycall/1189)

<div class="topic-metadata">

**Author:** [@bluesmoon](https://discourse.julialang.org/u/bluesmoon)\
**Replies:** 5\
**Last updated:** [December 29, 2016, 5:50pm UTC](https://discourse.julialang.org/t/keyerror---array-interface---not-found-when-using-pycall/1189 "2016-12-29T17:50:53Z")

</div>

I’m using PyCall 1.7.1 in julia 0.4 to call out to a python 3.4 library, and there are cases when the library throws a PyCall.PyError. When I try to inspect the :\_\_class\_\_ of this error, I get an error: # ex is an excep…

---

## [Syntax for generator](https://discourse.julialang.org/t/syntax-for-generator/1200)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [December 29, 2016, 1:33pm UTC](https://discourse.julialang.org/t/syntax-for-generator/1200 "2016-12-29T13:33:03Z")

</div>

I understand that in 0.5, you can use generators, and that the syntax is functionname(generator) eg sum(x^2 for x in 1:9 if isodd(x)) However, is there syntax for just the generator, without applying it? Ie I am look…

---

## [Custom iterators over custom types](https://discourse.julialang.org/t/custom-iterators-over-custom-types/1160)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 21\
**Last updated:** [December 29, 2016, 1:41am UTC](https://discourse.julialang.org/t/custom-iterators-over-custom-types/1160 "2016-12-29T01:41:26Z")

</div>

I am exploring the type system of Julia seriously for the first time and I got stuck with a practical problem I have in one of my packages. Suppose I have various grid types following an interface: @doc doc""" A data …

---

## [WAMP over WebSockets](https://discourse.julialang.org/t/wamp-over-websockets/1183)

<div class="topic-metadata">

**Author:** [@TsurHerman](https://discourse.julialang.org/u/TsurHerman)\
**Replies:** 0\
**Last updated:** [December 28, 2016, 1:16pm UTC](https://discourse.julialang.org/t/wamp-over-websockets/1183 "2016-12-28T13:16:00Z")

</div>

I am looking for a Julia implementation of WAMP over WebSockets. Do you know of anything? … half baked is good enough for me. Thanks Tsur

---

## [Tuple, Array length confusion](https://discourse.julialang.org/t/tuple-array-length-confusion/1185)

<div class="topic-metadata">

**Author:** [@richthanki](https://discourse.julialang.org/u/richthanki)\
**Replies:** 3\
**Last updated:** [December 28, 2016, 2:34pm UTC](https://discourse.julialang.org/t/tuple-array-length-confusion/1185 "2016-12-28T14:34:18Z")

</div>

A hopefully simple question. In 0.5.0 I find the following behaviour perfectly intuitive: julia\> length( \[0.4,0.6,0.8\] ) 3 julia\> length( (0.4,0.6,0.8) ) 3 But the following feels deeply counterintuitive for tuples: j…

---

## [Escaping of nested blocks](https://discourse.julialang.org/t/escaping-of-nested-blocks/1157)

<div class="topic-metadata">

**Author:** [@TomasPuverle](https://discourse.julialang.org/u/TomasPuverle)\
**Replies:** 9\
**Last updated:** [December 28, 2016, 6:01am UTC](https://discourse.julialang.org/t/escaping-of-nested-blocks/1157 "2016-12-28T06:01:59Z")

</div>

Hi, I am trying to learn to work with macros and ASTs, but am running into a bit of confusion regarding escaping. I haven’t found a lot of documentation regarding this, but if there is an authorative source, I would ap…

---

## [Memory Allocation Analysis - Memory assigned on comment lines](https://discourse.julialang.org/t/memory-allocation-analysis-memory-assigned-on-comment-lines/1125)

<div class="topic-metadata">

**Author:** [@Jason\_McConochie](https://discourse.julialang.org/u/Jason_McConochie)\
**Replies:** 5\
**Last updated:** [December 27, 2016, 8:21am UTC](https://discourse.julialang.org/t/memory-allocation-analysis-memory-assigned-on-comment-lines/1125 "2016-12-27T08:21:15Z")

</div>

I’m running a function in a module and running a user memory allocation analysis. An extract from the function .mem file shows apparently memory allocation on commented lines. What does this mean? - # end …

---

## [Using \`end\` when \`size\` is not definable](https://discourse.julialang.org/t/using-end-when-size-is-not-definable/1138)

<div class="topic-metadata">

**Author:** [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Replies:** 2\
**Last updated:** [December 26, 2016, 10:23pm UTC](https://discourse.julialang.org/t/using-end-when-size-is-not-definable/1138 "2016-12-26T22:23:36Z")

</div>

This is an odd question so let me motivate it by an example. Say we have a Vector of Vectors: a = \[\[3\];\[2;3\];\[3;1\]\]. These types may be easier to handle if one could directly index them, so we define a wrapper type VecVe…

---

## [Type inference of sum result](https://discourse.julialang.org/t/type-inference-of-sum-result/1121)

<div class="topic-metadata">

**Author:** [@Diego\_Javier\_Zea](https://discourse.julialang.org/u/Diego_Javier_Zea)\
**Replies:** 2\
**Last updated:** [December 26, 2016, 8:54pm UTC](https://discourse.julialang.org/t/type-inference-of-sum-result/1121 "2016-12-26T20:54:01Z")

</div>

Is there a reason way @code\_warntype shows the output of sum(m::Vector{Float64}) to be Any instead of Float64? (Julia 0.5.0 commit 3c9d753) Is It a bug? Best julia\> const m = rand(200); julia\> @code\_warntype sum(m) Var…

---

## [Performant handling of overflowing constants on 32-bit Julia Installations](https://discourse.julialang.org/t/performant-handling-of-overflowing-constants-on-32-bit-julia-installations/1143)

<div class="topic-metadata">

**Author:** [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Replies:** 4\
**Last updated:** [December 26, 2016, 2:52am UTC](https://discourse.julialang.org/t/performant-handling-of-overflowing-constants-on-32-bit-julia-installations/1143 "2016-12-26T02:52:43Z")

</div>

A part of some of my packages have really large integer constants saved in them (reference to one page). These constants need to be stored at the highest precision possible, and then changed to a type T that a user reque…

---

## [Reshape a tridimentional matrix](https://discourse.julialang.org/t/reshape-a-tridimentional-matrix/1146)

<div class="topic-metadata">

**Author:** [@Naelson\_douglas](https://discourse.julialang.org/u/Naelson_douglas)\
**Replies:** 1\
**Last updated:** [December 25, 2016, 1:08pm UTC](https://discourse.julialang.org/t/reshape-a-tridimentional-matrix/1146 "2016-12-25T13:08:20Z")

</div>

Hello. I wrote a code in Julia 4.7 that uses a reshape of a 3D matrix just like this: a = ones(2,2) b = ones(2,2) c = ones(2,2) d = reshape(\[\[a\],\[b\],\[c\]\], (2,2,3) The code used to work ( on version 0.4.7 (check…

---

## [\`@def\` macro generator broken on master](https://discourse.julialang.org/t/def-macro-generator-broken-on-master/1096)

<div class="topic-metadata">

**Author:** [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Replies:** 2\
**Last updated:** [December 21, 2016, 7:56pm UTC](https://discourse.julialang.org/t/def-macro-generator-broken-on-master/1096 "2016-12-21T19:56:54Z")

</div>

I use this @def on v0.5 to generate macros for inlining code. julia\> macro def(name, definition) return quote macro $name() esc($(Expr(:quote, definition))) …

---

## [Long startup time when loading Plots.jl](https://discourse.julialang.org/t/long-startup-time-when-loading-plots-jl/1120)

<div class="topic-metadata">

**Author:** [@cripcate](https://discourse.julialang.org/u/cripcate)\
**Replies:** 9\
**Last updated:** [December 24, 2016, 1:46am UTC](https://discourse.julialang.org/t/long-startup-time-when-loading-plots-jl/1120 "2016-12-24T01:46:24Z")

</div>

Hey Guys, I’m new to Julia and also programming in general. I’m checking out Julia as an alternative to python for scientific purposes. So I was wondering what’s up with my super long startup times. I also did a reddit …

---

## [Using Documenter.jl](https://discourse.julialang.org/t/using-documenter-jl/1115)

<div class="topic-metadata">

**Author:** [@Balinus](https://discourse.julialang.org/u/Balinus)\
**Replies:** 6\
**Last updated:** [December 23, 2016, 8:38pm UTC](https://discourse.julialang.org/t/using-documenter-jl/1115 "2016-12-23T20:38:04Z")

</div>

Hello, I’m trying to deploy some basic documentation for my package ClimateTools.jl using Documenter.jl. I have an error when trying to run make.jl from the command line \[user@doris docs\]$ julia --color=yes /home/user…

---

## [Julia ask me to install Lazy.jl after \`Pkg.update()\`](https://discourse.julialang.org/t/julia-ask-me-to-install-lazy-jl-after-pkg-update/1109)

<div class="topic-metadata">

**Author:** [@Alvaro\_M](https://discourse.julialang.org/u/Alvaro_M)\
**Replies:** 1\
**Last updated:** [December 23, 2016, 2:36am UTC](https://discourse.julialang.org/t/julia-ask-me-to-install-lazy-jl-after-pkg-update/1109 "2016-12-23T02:36:39Z")

</div>

Hello: I make today a Pkg.update() after that, using DataFrames or using Gadfly ask me to install Lazy.jl. The system didn’t do it before update and with other libraries they don’t ask either. Regards.

---

## [Serializing composite type to json](https://discourse.julialang.org/t/serializing-composite-type-to-json/1055)

<div class="topic-metadata">

**Author:** [@Frank\_Langel](https://discourse.julialang.org/u/Frank_Langel)\
**Replies:** 4\
**Last updated:** [December 23, 2016, 12:14am UTC](https://discourse.julialang.org/t/serializing-composite-type-to-json/1055 "2016-12-23T00:14:55Z")

</div>

Hi, i have a type foo id::String .. end How to I serialize this to JSON easily ? Looking for JSON.toJson(Foo("Hello")) JSON.jl accepts dictionaries only :=( Thanks a lot Frank

---

## [Sparsification of a Type](https://discourse.julialang.org/t/sparsification-of-a-type/1090)

<div class="topic-metadata">

**Author:** [@abulak](https://discourse.julialang.org/u/abulak)\
**Replies:** 9\
**Last updated:** [December 22, 2016, 10:51pm UTC](https://discourse.julialang.org/t/sparsification-of-a-type/1090 "2016-12-22T22:51:00Z")

</div>

My first steps in julia, and one of the first in programming;) I have defined MyType ( I need it both for Float, Rational{BigInt} and Complex, hence T\<:Number type MyType{T\<:Number} coords::Vector{T} name::String some\_…

---

## [Helping julia with runtime dispatch/arrowtypes](https://discourse.julialang.org/t/helping-julia-with-runtime-dispatch-arrowtypes/1104)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 3\
**Last updated:** [December 22, 2016, 6:10pm UTC](https://discourse.julialang.org/t/helping-julia-with-runtime-dispatch-arrowtypes/1104 "2016-12-22T18:10:43Z")

</div>

I have a program in which there are states about which I need to check whether some predicates hold or not. type State ... end immutable Predicate f::Function end (p::Predicate)(s::State)::Bool = p.f(s) Now…

---

## [Types and gradients, including Forward.gradient](https://discourse.julialang.org/t/types-and-gradients-including-forward-gradient/946)

<div class="topic-metadata">

**Author:** [@Patrik\_Waldmann](https://discourse.julialang.org/u/Patrik_Waldmann)\
**Replies:** 20\
**Last updated:** [December 20, 2016, 10:55am UTC](https://discourse.julialang.org/t/types-and-gradients-including-forward-gradient/946 "2016-12-20T10:55:09Z")

</div>

This thing with types is not so easy in the beginning. I’m trying to use the gradient() function on an Any array, but it does not work. Could someone help me with the type of the w array? Second, I want to compare the ba…

---

## [Share object between master/workers](https://discourse.julialang.org/t/share-object-between-master-workers/1098)

<div class="topic-metadata">

**Author:** [@evanfields](https://discourse.julialang.org/u/evanfields)\
**Replies:** 2\
**Last updated:** [December 22, 2016, 2:22am UTC](https://discourse.julialang.org/t/share-object-between-master-workers/1098 "2016-12-22T02:22:39Z")

</div>

Is there a way to share an instance of a non-bits type between the master process and one or more workers? I’d like to do something like the following: addprocs(1) @everywhere MyType x end @everywhere function print\_…

---

## [Square bracket setindex! in macro argument](https://discourse.julialang.org/t/square-bracket-setindex-in-macro-argument/1095)

<div class="topic-metadata">

**Author:** [@GordStephen](https://discourse.julialang.org/u/GordStephen)\
**Replies:** 2\
**Last updated:** [December 21, 2016, 6:45pm UTC](https://discourse.julialang.org/t/square-bracket-setindex-in-macro-argument/1095 "2016-12-21T18:45:11Z")

</div>

Hi all, I’m using macros to generate functions with repetitive structure (in this case, modifying one or more vectors in place). The following works well: macro mymacro(ex) return quote for i in eachindex(Y…

---

## [Overflow behaviour - how to explain](https://discourse.julialang.org/t/overflow-behaviour-how-to-explain/996)

<div class="topic-metadata">

**Author:** [@Balinus](https://discourse.julialang.org/u/Balinus)\
**Replies:** 9\
**Last updated:** [December 21, 2016, 6:15pm UTC](https://discourse.julialang.org/t/overflow-behaviour-how-to-explain/996 "2016-12-21T18:15:13Z")

</div>

Hello, I’m preparing a little introductory presentation for my team on Julia. I’d like to do some slides on where people should be careful. Overflow bahaviour is certainly one of them imho. I just don’t know how to expl…

---

## [Parallel execution of functions outside a loop is possible in Julia?](https://discourse.julialang.org/t/parallel-execution-of-functions-outside-a-loop-is-possible-in-julia/1091)

<div class="topic-metadata">

**Author:** [@Fred](https://discourse.julialang.org/u/Fred)\
**Replies:** 2\
**Last updated:** [December 21, 2016, 4:32pm UTC](https://discourse.julialang.org/t/parallel-execution-of-functions-outside-a-loop-is-possible-in-julia/1091 "2016-12-21T16:32:33Z")

</div>

Hi ! In Julia 0.5 it is possible to parallelize a function in a loop : @parallel (+) for i=1:100 Threads.@threads for i = 1:10 or to apply a function to all elements in some collection : pmap(f, c) But is …

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

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