Code Comments
Programming Forum and web based access to our favorite programming groups.Hello,
it seems ~Dimension(1) doesn't work correctly if an array is filled by
[] or ~Append
a = .array~New(0)
A[1] = ' '
A[2] = "Mike"
A[3] = "Rick"
say a~dimension() -- Shows: 1 , that's correct
say a~dimension(1) -- Shows: 0 , I would expect 3
If the array is filled by ~of(...) all works fine
/**/
a = .array~of(,"Mike","Rick")
say a~dimension() -- Shows: 1, that's correct
say a~dimension(1) -- Shows: 3. That's also correct
Append seems to have the same problem
a = .array~New(0)
A~Append(' ')
A~Append("Mike")
A~Append("Rick")
say a~dimension() -- Shows 1, that's correct
say a~dimension(1) -- Shows: 0 , I would expect 3
If I combine ~Of() and Append() all works fine also
a = .array~of('')
A~Append("Mike")
A~Append("Rick")
say a~dimension() -- Shows: 1
say a~dimension(1) -- Shows 3
Any Idea why ~of works different to [] or ~Append()
Thanks ...... Martin
Post Follow-up to this messageLooks like a bug to me. You should open an error report at the
sourceforge site. This only seems occur when you explicitly specify 0
for the initial size. If you use the default size or specify a non-zero
size, everything seems to work as you would expect.
Rick
mberg wrote:
> Hello,
> it seems ~Dimension(1) doesn't work correctly if an array is filled by
> [] or ~Append
>
> a = .array~New(0)
> A[1] = ' '
> A[2] = "Mike"
> A[3] = "Rick"
>
> say a~dimension() -- Shows: 1 , that's correct
> say a~dimension(1) -- Shows: 0 , I would expect 3
>
> If the array is filled by ~of(...) all works fine
>
> /**/
> a = .array~of(,"Mike","Rick")
> say a~dimension() -- Shows: 1, that's correct
> say a~dimension(1) -- Shows: 3. That's also correct
>
> Append seems to have the same problem
>
> a = .array~New(0)
> A~Append(' ')
> A~Append("Mike")
> A~Append("Rick")
> say a~dimension() -- Shows 1, that's correct
> say a~dimension(1) -- Shows: 0 , I would expect 3
>
> If I combine ~Of() and Append() all works fine also
>
> a = .array~of('')
> A~Append("Mike")
> A~Append("Rick")
> say a~dimension() -- Shows: 1
> say a~dimension(1) -- Shows 3
>
>
> Any Idea why ~of works different to [] or ~Append()
>
> Thanks ...... Martin
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.