[Gambas-user] DIMing Arrays

Benoit Minisini gambas at ...1...
Wed May 4 11:53:03 CEST 2005


On Wednesday 04 May 2005 09:50, Eilert wrote:
> Bonjour Benoit,
>
> Benoit Minisini schrieb:
> > On Tuesday 03 May 2005 17:25, nando wrote:
> >>Note that
> >>
> >>PRIVATE my_array AS NEW String[]
> >>
> >>will not compile/run if a space exists
> >>between String and the [
> >
> > Yes, this is a syntax error :-)
>
> Is this wanted or just "something we cannot make better":
>
> In practice, there are many cases where something counts from 0 but is
> interpreted like 1, i. e. you will have to write a "- 1" here and there.
>
> If you leave out the space, it is interpreted as a "-1" value, thus
> leading to error messages. From its context, one might expect the
> interpreter to interprete it as "x - 1", but even the editor doesn't as
> the colors will tell you when you leave the line.
>
> You know what I mean?
>
> For j = 0 to my_array.Count-1
>
> won't do as it's interpreted as a "-1", and a "-1" doesn't belong there.
>
> Or
>
> t$ = Mid$(x$, i-1, 1)
>
> won't do either.
>
> In both cases (and from my vague understanding of the mechanisms) the
> parser will detect a "-1" because it's token-orientated and does not see
> the context.
>
> Rolf
>

I think I finally fixed that. Now I can write "i= i-1" and get "i = i - 1", or 
write "i=i+-1" and get "i = i + -1".

I hope you will be happy :-)

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list