Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

array~Dimension(1) does not work in every case ?
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

Report this thread to moderator Post Follow-up to this message
Old Post
mberg
03-28-08 12:35 AM


Re: array~Dimension(1) does not work in every case ?
Looks 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

Report this thread to moderator Post Follow-up to this message
Old Post
Rick McGuire
03-28-08 01:15 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Rexx archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:59 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.