some info that's more beginner level than other replies (so sorry if this 
is obvious).

the compiler translates x[end] into x[endof(x)] so you get this error if 
you use [end] after something that isn't expecting it.

at the most basic, perhaps you thought something was an array when it 
wasn't.

if you want to make this work for a new type then you need to extend both 
Base.endof and Base.getindex so that those functions exist for your new 
type.  of course, it will work automatically for arrays of your new type, 
but not for a single instance.

andrew


On Monday, 3 March 2014 23:30:50 UTC-3, xdavidliu wrote:
>
> Hi, I'm having some issues with "endof". Here's an example that hopefully 
> is self-explanatory enough not to need any context or "smallest code that 
> reproduces the error"; perhaps someone can tell me if I'm doing something 
> stupid. If not, I'd be happy to reproduce the error.
>
>
>
>
> In [7]:
>
> (geo.eps)[end]
>
> no method endof(Ptr{PetscVec_s},)
> at In[7]:1
>
>
> In [8]:
>
> endof(geo.eps)
>
> Out[8]:
>
> 202
>
>
>

Reply via email to