[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
_Compare, passes array to single value compare.. Bug?
[Thread Prev] | [Thread Next]
- Subject: _Compare, passes array to single value compare.. Bug?
- From: Brian G <brian@xxxxxxxxxxxxxxxx>
- Date: Wed, 10 Jul 2024 08:29:09 -0700
- To: GambasList <user@xxxxxxxxxxxxxxxxxxxxxx>
When I have an object called myobject with a _compare() the compiler passes both myobject and myobject[] to the function. But does not pass either when both are myobject[]. Not sure what the correct behavior is, but it seems incorrect to pass [] to a single myobject.
Anybody know what it should happen, or do we have to guard against receiving an [], what should be the correct return value when we get an [].
Sample script -------------------------------------------------------------------------- #!/usr/bin/env gbs3 'Auto Generated Script 07/10/2024 15:15:32.628 Version (3.19.90) #Script Startup="Main" #Script Version="0.0.1" class cmpit ' Gambas class file Public value As Variant = Null Public Sub _new(newvalue As Variant) value = newvalue End Public Sub _compare(rvalue As Variant) As Integer If value = rvalue.value Then Return 0 If value > rvalue.value Then Return 1 Return -1 End End class ' Gambas module file Public Sub Main() Print "Hello world" Dim a As New Cmpit(9) Dim b As New Cmpit(10) Dim c As Variant = a Dim e As New Cmpit[10] For i As Integer = 0 To e.Max e[i] = New Cmpit(9) Next Print Str(a = b), Str(c = a) Print Str(a = e) End _________________________________________________________________- -- ~~~~ Brian
Attachment:
OpenPGP_0x78BFB26402F48419.asc
Description: OpenPGP public key
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature
Re: _Compare, passes array to single value compare.. Bug? | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |
Re: _Compare, passes array to single value compare.. Bug? | Bruce Steers <bsteers4@xxxxxxxxx> |