[Gambas-user] Another possible change...
Nelson Ferraz
nferraz at ...184...
Mon Dec 15 00:10:28 CET 2003
Benoit Minisini wrote:
> Array.Reverse() is done, but does not return anything. So the previous example
> needs at least two lines of code !
>
> I did it, because returning an object reference has a cost, so it must be
> avoided as possible.
Okay!
BTW, does Gambas use exclamation points (!) for anything?
In Ruby, some methods are named with an exclamation point to indicate
that they modify some data.
Applied to Gambas, it would work like this:
newArray = myArray.Reverse ' return a reversed array
myArray.Reverse! ' reverse this array!
newArray = myArray.Sort ' returns a sorted array
myArray.Sort! ' sort this array!
newString = myString.Reverse ' returns a reversed string
myString.Reverse! ' reverse this string!
I know this isn't BASIC as we know it, but it's an interesting idea
nonetheless.
--
[]s
Nelson
________________________________________________________________
Nelson Ferraz
GNU BIS: http://www.gnubis.com.br
PhPerl: http://www.phperl.com
More information about the User
mailing list