Gambas3 > Segnalazione bug

IsNumber, IsBoolean, Is.....

(1/3) > >>

milio:
Ieri sera ho scaricato l'ultima versione di Gambas3 (la 3398) e, con mio rammarico, mi son dovuto scontrare con un cambiamento radicale delle funzioni in oggetto.
Queste funzioni servivano a riconoscermi il tipo di valore che andavo a recuperare dai campi delle tabelle

Prima:

  Function IsNumber(Value As Variant) As Boolean

Dopo:

  Function IsNumber(Value As String) As Boolean


Non riesco a capire il perche' di questo cambiamento... Naturalmente cio' stravolge tutto il mio progetto di GridBox :(
Ha, e la funzione IsString e' stata pure tolta!  :evil:

milio:
mii era da mo che non aggiornavo...  ;D
Ho guardato il ChangeLog e risulta appunto questo:

r3329 | gambas | 2010-11-28 00:00:08 +0100 (dom, 28 nov 2010) | 18 lines

[INTERPRETER]
* NEW: The scaring change. IsByte(), IsShort(), IsSingle(), IsString(),
  IsPointer(), IsObject() and IsVariant() have been removed. IsNull() has
  been kept unchanged.
* NEW: IsInteger() now returns if a string can be converted to an Integer
  number.
* NEW: IsLong() now returns if a string can be converted to an Integer or a
  Long number.
* NEW: IsFloat() now returns if a string can be converted to a Float, but
  not an Integer or a Long.
* NEW: IsNumber() now returns if a string can be converted to an Integer, a
  Long or a Float.
* NEW: IsDate() now returns if a string can be converted to a Date.
* NEW: Str(True) and Str(False) now use the translation of the "True" and
  "False" string, if they exist in the current project.
* NEW: Val() now uses the translation of the "True" and "False" string, if
  they exist in the current project.

leo72:
Bah! Scelta alquanto discutibile.  ???

perseo:
Ho deciso di aggiornare anch'io ad una release più recente e purtroppo mi sono imbattuto nello stesso tipo di errore.

IsBoolean viene usato nella classe di PDFWriter alla riga 1264...


--- Codice: gambas --- 'Normalize parameters
  If (IsBoolean(dest)) Then dest = IIf(dest, "D", "F")
  dest = Upper(dest)
  If (dest = "") Then
    If (name = "") Then
      name = "doc.pdf"
      dest = "I"
    Else
      dest = "F"
    End If
  End If
--- Termina codice ---


Come possiamo risolvere il problema? Secondo voi devo riportare l'errore dovuto all'aggiornamento anche nel post di PDFWriter?
Credo che la soluzione sia di scrivere una Function che sostituisca True or False, in sostituzione di IsBoolean...
Anzi... la chiamiamo proprio IsBoolean, così non debbiamo cambiare neppure il testo...  :D

Mi ha dato il medesimo errore anche con IsString e IsObject.

Ho provato a risolvere scrivendo una funzione privata nella Classe di PDFWriter:


--- Codice: gambas ---Private Function IsBoolean($condizione as Variant) as Boolean
  If TypeOf($condizione) = gb.Boolean Then
    Return True
  Else
    Return False
  Endif
End
--- Termina codice ---


Ma mi restituisce comunque l'errore Type Mismatch: Wanted String, Got Boolean Instead.

PS. "IsBoolean" si trova anche alle righe 914, 1023, 1057, 1092, (1264) 4132, 4253, 4289, 4326...

Ceskho:
Credo sia indubbiamente ed altamente più costruttivo scrivere una missiva direttamente alla spettabile attenzione di Benoit richiedendo la corretta implementazione delle funzioni suddette anziché scrivere codice che potrebbe risultare alquanto ridondante e futile poiché già intrinseco al linguaggio stesso...








Ma come caspita parlo?  :hard: :hard:

Navigazione

[0] Indice dei post

[#] Pagina successiva

Vai alla versione completa