Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Micha Nelissen
Graeme Geldenhuys wrote: Simple one liners like the following: inc(FDayList[itm.WeekDayNum].Rows[itm.Timeslot].AvailableSlots, itm.CountSlots); or FDayList[itm.WeekDayNum].Rows[itm.Timeslot].AvailableSlots += itm.CountSlots; now has to change to this ugly line... FDayList[itm.WeekDayN

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Micha Nelissen
Jonas Maebe wrote: Indeed. I've checked the code and properties are explicitly not allowed for the C-style operators. The reason is that the x+=y is translated into "x:=x+y" at the parser level rather than at the lexical level. This So I guess the obvious question is: would it be risky to cha

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Jonas Maebe
On 17 Jul 2008, at 08:41, Graeme Geldenhuys wrote: Simple one liners like the following: inc(FDayList[itm.WeekDayNum].Rows[itm.Timeslot].AvailableSlots, itm.CountSlots); or FDayList[itm.WeekDayNum].Rows[itm.Timeslot].AvailableSlots += itm.CountSlots; now has to change to this ugly line

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Daniël Mantione
Op Thu, 17 Jul 2008, schreef Micha Nelissen: Graeme Geldenhuys wrote: Simple one liners like the following: inc(FDayList[itm.WeekDayNum].Rows[itm.Timeslot].AvailableSlots, itm.CountSlots); or FDayList[itm.WeekDayNum].Rows[itm.Timeslot].AvailableSlots += itm.CountSlots; now has to ch

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Jonas Maebe
On 17 Jul 2008, at 08:48, Graeme Geldenhuys wrote: On Wed, Jul 16, 2008 at 5:37 PM, Jonas Maebe <[EMAIL PROTECTED] > wrote: Indeed. I've checked the code and properties are explicitly not allowed for the C-style operators. The reason is that the x+=y is translated into "x:=x+y" at the parser

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Jonas Maebe
On 17 Jul 2008, at 09:09, Daniël Mantione wrote: Even shorter: with itm do with FDayList[WeekDayNum].Rows[Timeslot] do AvailableSlots:=AvailableSlots+CountSlots; Even shorter: with itm, FDayList[WeekDayNum].Rows[Timeslot] do AvailableSlots:=AvailableSlots+CountSlots; But nested or c

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Graeme Geldenhuys
On Thu, Jul 17, 2008 at 9:05 AM, Micha Nelissen <[EMAIL PROTECTED]> wrote: >> Simple one liners like the following: >> >> inc(FDayList[itm.WeekDayNum].Rows[itm.Timeslot].AvailableSlots, >> itm.CountSlots); >> or >> FDayList[itm.WeekDayNum].Rows[itm.Timeslot].AvailableSlots += >> itm.CountSlots;

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Graeme Geldenhuys
On Thu, Jul 17, 2008 at 9:07 AM, Micha Nelissen <[EMAIL PROTECTED]> wrote: > Jonas Maebe wrote: >> >> Indeed. I've checked the code and properties are explicitly not allowed >> for the C-style operators. The reason is that the x+=y is translated into >> "x:=x+y" at the parser level rather than at t

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Graeme Geldenhuys
On Thu, Jul 17, 2008 at 9:09 AM, Jonas Maebe <[EMAIL PROTECTED]> wrote: > Or > > with FDayList[itm.WeekDayNum].Rows[itm.Timeslot] do > AvailableSlots:= AvailableSlots+itm.CountSlots; No that's one language construct I wish Object Pascal could do without! I personally hate the 'with' statement,

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Graeme Geldenhuys
On Thu, Jul 17, 2008 at 9:38 AM, Graeme Geldenhuys <[EMAIL PROTECTED]> wrote: > At least FPC with mode objfpc had the common sense NOT to allow the > following (which I believe is still allowed in Delphi). Also tooltip > evaluation/debugging doesn't work with 'with' statements in Lazarus or > Delp

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Graeme Geldenhuys
2008/7/17 Jonas Maebe <[EMAIL PROTECTED]>: > Even shorter: > > with itm, FDayList[WeekDayNum].Rows[Timeslot] do > AvailableSlots:=AvailableSlots+CountSlots; Arg [grinding my teeth] Nested with statements are even worse than my previous complaint! ;-) Regards, - Graeme - __

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Daniël Mantione
Op Thu, 17 Jul 2008, schreef Graeme Geldenhuys: On Thu, Jul 17, 2008 at 9:09 AM, Jonas Maebe <[EMAIL PROTECTED]> wrote: Or with FDayList[itm.WeekDayNum].Rows[itm.Timeslot] do AvailableSlots:= AvailableSlots+itm.CountSlots; No that's one language construct I wish Object Pascal could do wi

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Micha Nelissen
Graeme Geldenhuys wrote: My question too Would somebody be so kind as to explain the difference to me? As I mentioned before, I'm not a compiler developer. Very rudimentary: source --lexer--> tokens --parser--> tree --code gen--> code - source is the .pas file etc. - tokens are things

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Boian Mitov
This is if you like the risk of using "with" ;-) This works until somebody changes the FDayList[WeekDayNum].Rows[Timeslot] to contain CountSlots property, and all your code is broken ;-) . If you want stable code, never use the "with" or else ... ;-) With best regards, Boian Mitov

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Michael Schnell
If you want stable code, never use the "with" or else ... ;-) I did learn this even in the early Delphi days ;) Moreover AFAIK, even the newest Delphi does not show the value of variables that are qualified using a "with". So you even can't debug the broken code decently. -Michael

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Boian Mitov
There are a lot of fans of "with" ;-) . I have been burned however long time ago. Now when I get a new code from somebody, my first task is to remove any "with" from it ;-). As far as I am concerned "with" is a Pascal design bug. May the guy who invented "with" track "with" bugs for eternity ;-)

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Michael Schnell
Boian Mitov wrote: There are a lot of fans of "with" ;-) . I have been burned however long time ago. Now when I get a new code from somebody, my first task is to remove any "with" from it ;-). As far as I am concerned "with" is a Pascal design bug. May the guy who invented "with" track "with"

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Boian Mitov
You will hardly find any in our components ;-) . Not as long as I run the company, and do most of the work. I even plan to add preprocessor to catch missed "with" during the build process. With best regards, Boian Mitov M

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Martin Friebe
Or Add a Method to the target object. (as long as it is part of your code base, or can be modified by you) and then do FDayList[itm.WeekDayNum].Rows[itm.Timeslot].AvailableSlotsInc(itm.CountSlots); In the class that defines property AvailableSlot; you can add procedure AvailableSlotsInc(n : I

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Martin Friebe
From my understanding ( the fpc team probably can to more exact): * lexical level This would be like a simple "Find and Replace" on the text. This would work with anything, as it doesn't know what it is translating. (It is very similar to a (non-buildin) C-preprocessor) * parser level The pars

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Joao Morais
Graeme Geldenhuys wrote: So is what you mentioned above by design, or an oversight? In normal code like "x := x+y" you are allowed to use properties or variables. So surely the += operator which translates to "x := x+y" should also be allowed to use properties. Except that, when using variabl

Re: [fpc-devel] Illegal type conversion: "" to "TObject"

2008-07-17 Thread Florian Klaempfl
Sean McIlwain schrieb: The following code fails to compile in Delphi mode but successfully compiles in objfpc mode: type TEnum = (a, b, c); var AValue: TEnum; AObject : TObject; implementation initialization AObject := TObject(AValue); Could this be supported in the Delphi mode as well?

Re: [fpc-devel] Illegal type conversion: "" to "TObject"

2008-07-17 Thread Micha Nelissen
Sean McIlwain wrote: initialization AObject := TObject(AValue); Could this be supported in the Delphi mode as well? Forgot to take your pills today? ;) Micha ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mail

[fpc-devel] [patch] minor changes to fcl-db codegen unit fpccgtiopf.pp

2008-07-17 Thread Graeme Geldenhuys
This needs to be applied from the trunk directory. All very minor changes... Changes include * Minor classname adjustment * Query.SQL.Text ---> Query.SQLText otherwise the setter method is bypassed, which could contain custom code. * uses clause cleanup Regards, - Graeme - __

re: [fpc-devel] Incompatible Types: got "untyped" expected "

2008-07-17 Thread Craig Peterson
> Matthias Gaertner wrote: I'm getting a Error: Incompatible Types: got "untyped" expected " when compiling the following code. This happens when using default parameter values. Use mode objfpc and CallBack:[EMAIL PROTECTED] Is there some reason why this can't be handled automatically in D

Re: [fpc-devel] Incompatible Types: got "untyped" expected "

2008-07-17 Thread Micha Nelissen
Craig Peterson wrote: Use mode objfpc and CallBack:[EMAIL PROTECTED] Is there some reason why this can't be handled automatically in Delphi mode? In the example (and every case where it's an issue in our code), the callback is a procedure and doesn't return anything, so "Callback := Proc" i

Re: [fpc-devel] Incompatible Types: got "untyped" expected "

2008-07-17 Thread Craig Peterson
Micha Nelissen wrote: Ambiguity depends on whether it takes parameters or not. Return value would be context sensitive. One doesn't want a context sensitive language. The code presented is perfectly valid in Delphi, so it apparently *is* a context sensitive language, and I'm sure we're not the

Re: [fpc-devel] Incompatible Types: got "untyped" expected "

2008-07-17 Thread Micha Nelissen
Craig Peterson wrote: Micha Nelissen wrote: Ambiguity depends on whether it takes parameters or not. Return value would be context sensitive. One doesn't want a context sensitive language. The code presented is perfectly valid in Delphi, so it apparently *is* a context sensitive language, an

Re: [fpc-devel] Incompatible Types: got "untyped" expected "

2008-07-17 Thread Craig Peterson
> Yes but this has got nothing to do with original poster's problem :-). Sean (the original poster) is my coworker, so his problem and mine are one and the same. ;-) I'm having a little trouble parsing your responses though, so to clarify: In Delphi, the following code works: procedure Bt

Re: [fpc-devel] Incompatible Types: got "untyped" expected "

2008-07-17 Thread Peter Vreman
> > Yes but this has got nothing to do with original poster's problem :-). > > Sean (the original poster) is my coworker, so his problem and mine are > one and the same. ;-) I'm having a little trouble parsing your > responses though, so to clarify: > > In Delphi, the following code works: > >

Re: [fpc-devel] C style operator doesn't work with properties in 2.3.1

2008-07-17 Thread Luca Olivetti
El Thu, 17 Jul 2008 09:15:46 +0200 Jonas Maebe <[EMAIL PROTECTED]> escribió: > But nested or combined with-statements can be dangerous in case > there are multiple fields with the same name in the different Many, many years ago, I programmed in texas instruments' pascal for the 9995. Of course it

Re: [fpc-devel] Illegal type conversion: "" to "TObject"

2008-07-17 Thread Michael Van Canneyt
On Thu, 17 Jul 2008, Florian Klaempfl wrote: > Sean McIlwain schrieb: > > The following code fails to compile in Delphi mode but successfully compiles > > in objfpc mode: > > > > type > > TEnum = (a, b, c); > > var > > AValue: TEnum; > > AObject : TObject; > > implementation > > > > initiali

Re: [fpc-devel] [patch] minor changes to fcl-db codegen unit fpccgtiopf.pp

2008-07-17 Thread Michael Van Canneyt
On Thu, 17 Jul 2008, Graeme Geldenhuys wrote: > This needs to be applied from the trunk directory. All very minor changes... > > Changes include > > * Minor classname adjustment > * Query.SQL.Text ---> Query.SQLText otherwise the setter method is > bypassed, which could contain custom code

Re: [fpc-devel] Illegal type conversion: "" to "TObject"

2008-07-17 Thread Micha Nelissen
Michael Van Canneyt wrote: >>> AObject := TObject(AValue); >>> >>> Could this be supported in the Delphi mode as well? >> Please submit a bug report. > > Eh ? > As far as I'm concerned this should not compile in Objfpc mode as well ? It's a typecast, so then almost anything is allowed, except p

Re: [fpc-devel] Unicode Letters

2008-07-17 Thread theo
ik schrieb: > In hebrew (at least) the punctuation is a different char that comes > after the letter, but painted like it was part of the letter, so you > can parse each word and ignore non letter value (it arrives in > different range in the unicode table). > > > Yes, the question is: which are

Re: [fpc-devel] Unicode Letters

2008-07-17 Thread Felipe Monteiro de Carvalho
On Wed, Jul 16, 2008 at 4:09 PM, theo <[EMAIL PROTECTED]> wrote: > Is there a better way to do what I need? I think that writing such a routine which compares the char to a table will be the best solution. -- Felipe Monteiro de Carvalho ___ fpc-devel m

Re: [fpc-devel] Unicode Letters

2008-07-17 Thread theo
Felipe Monteiro de Carvalho schrieb: > > I think that writing such a routine which compares the char to a table > will be the best solution. > > Yes, I've done this today. http://www.theo.ch/lazarus/woprsplitwords.pas It seems to work. Do you see any problems? Thanks Theo

Re: [fpc-devel] Illegal type conversion: "" to "TObject"

2008-07-17 Thread Vinzent Höfler
Micha Nelissen wrote: Michael Van Canneyt wrote: AObject := TObject(AValue); Could this be supported in the Delphi mode as well? Please submit a bug report. Eh ? As far as I'm concerned this should not compile in Objfpc mode as well ? It's a typecast, so then almost anything is allowed, ex

Re: [fpc-devel] Illegal type conversion: "" to"TObject"

2008-07-17 Thread Boian Mitov
Now only if we can go ~15 years back in time and tell that to the original developers of VCL and things like TStrings and their data type ;-) . Unfortunately they take TObject only, and there are a lot of cases when casting other data types to it is needed. I wish it was not the case, but it is

Re: [fpc-devel] Illegal type conversion: "" to"TObject"

2008-07-17 Thread Vinzent Höfler
Boian Mitov wrote: Now only if we can go ~15 years back in time and tell that to the original developers of VCL and things like TStrings and their data type ;-) . Unfortunately they take TObject only, and there are a lot of cases when casting other data types to it is needed. I wish it was not