[Gambas-user] Gambas IDE 1.9.49-2 New Function formating.

ron ronstk at ...239...
Tue Jun 26 17:54:13 CEST 2007

On Tuesday 26 June 2007 11:41, Andreas Kostyrka wrote:
> Nope, as I've pointed out already, NEW is an operator. New is a function.

If your 'New' is a _function_, I must assume it is made by you in your code.

As the syntax give examples as:

a)  hButton = New("Button", hParent) ' or
b)  Button = NEW Button(ME) AS "MyButton" ' or
c)  DIM iMyArray AS NEW Integer[] ' and this one

'New' here is not a simple function but a constructor method and
returns a object, yes functions returns something to. (the way i see)

Did you made a function yourself as:

   FUNCTION New(sString,vArgs)
   dim iTmp as INTEGER
    return iTmp

Beside both New' and NEW' are reserved words in gambas and the example 
function above should even normally not be allowed to make yourself.

Simply as your previous code is $entries.Add(New("ABC", arg1))
you do not tell exact what you want. 
I assume "ABC" is just typing something but it is not unimportant.

The "ABC" argument should be a control or data type or results to it.
There is no control named "ABC" or data type with that id.

The only conclusion is that you made yourself the function 'New' 
which clashes with the reserved keywords in gambas.
Gambas can only highlight/beautify the code as is done

  $entries.Add(New("ABC", arg1)) ' you try syntax rule 'a'

gets changed by the IDE to

  $entries.Add( NEW ("ABC", arg1)) ' because function New("a",b) can't

What happen if you do $entries.Add(New("Button", arg1)) ?

As I suggest previous, do it with two lines and this complex 
construction could/should be solved.

Lets wait what Benoit say more about it. I can be wrong to :(


More information about the User mailing list