If a method isn't found at compile time (to check for inlining), the method lookup is deferred until runtime. This leads to nicer interactive work at the REPL when I happen to define a function that calls another function that I define afterwards (but before running).
At least that's my understanding. It may be a bit more nuanced than that. -Jacob On Tue, Oct 28, 2014 at 10:03 PM, Kapil <[email protected]> wrote: > Oh okay. In that case, shouldn't an error be generated at compile time ? > ᐧ > > Regards, > Kapil Agarwal > > On Tue, Oct 28, 2014 at 10:02 PM, Andreas Noack < > [email protected]> wrote: > >> times[1] is the first element of the matrix times. Hence, then writing >> times[1][1] you are trying to setindex a scalar. If you want to select the >> 1,1 element of times then you should write times[1,1]. >> >> Med venlig hilsen >> >> Andreas Noack >> >> 2014-10-28 21:58 GMT-04:00 Kapil Agarwal <[email protected]>: >> >> Hi >>> >>> I have the following piece of code and I am getting a setindex! error >>> which I am unable to figure out- >>> >>> times = Array(Float64,(4,10)); # 4 X 10 matrix >>> a=fill(1.0,10); >>> c=fill(0.0,10); >>> times[1][1] = @elapsed @parallel for j=1:10 >>> c[j] = a[j]; >>> end >>> >>> ERROR: `setindex!` has no method matching setindex!(::Float64, >>> ::Float64, ::Int64) >>> >>> What could be the problem ? >>> >>> Kapil >>> >> >> >
