[Gambas-user] Property question....
Benoit Minisini
gambas at ...1...
Sun Mar 16 00:32:31 CET 2008
On samedi 15 mars 2008, Stephen Bungay wrote:
> >>>>>
> >>>>> An assignment of a result set to property 'RecordSet' will yield
> >>>>> "Unknown identifier: RecordSet at line [line number] in
> >>>>> [formname].class.
> >>>>
> >>>> This is a compiler error. Please explain how you can get it at runtime
> >>>> while assigning the property!
> >>>
> >>> Yes the error is happening at compile time and is something I did
> >>> not expect (i.e. since RecordSet is declared as a property it should be
> >>> a 'known' identifier).
> >>
> >> So if we have a button on the form called Button1 and the intent of
> >> this action is to execute an SQL and assign the result to the property
> >> 'RecordSet', that is where the compiler presents the error. It appears
> >> that the compiler isn't aware of the Property.
> >>
> >> Private Sub Button1_Click()
> >> 'Compiler gives an 'unknown identifier' error on the next line.
> >> RecordSet = DatabaseConnection.Exec("Select * FROM MyTable")
> >> END
> >
> > You must write ME.Recordset at the moment. I think this is a lack in the
> > compiler that cannot compile properties without ME, whereas it could with
> > methods and variables.
> >
> > Regards,
>
> Thanks Benoit.
>
This will be fix for Gambas 3.
I won't fix it for Gambas 2.4, as you will be able to make 2.4 projects that
cannot be compiled on 2.3 then. Maybe this is not a good idea!
But it is just a compiler limitation, it won't change anything in the
bytecode. Internally, "PropertyName = xxx" will be compiled the same way
as "ME.PropertyName = xxx".
Regards,
--
Benoit Minisini
More information about the User
mailing list