Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Michael Van Canneyt
On Thu, 16 Jul 2015, silvioprog wrote: Currently I made a wery fast websocket server[1] using Node.js, and I had some dificult to find an updated WS Pascal client compatible with FPC 3 and XE8, so I found one called Bauglir websocket, after some changes I could compile it in both compilers.

Re: [fpc-pascal] will be work macro with name of the unit?

2015-07-16 Thread ulrich
Dne 15.7.2015 v 10:16 Michael Van Canneyt napsal(a): On Tue, 14 Jul 2015, ulrich wrote: Hi, I have this unit, but when I compile it, I get this error: Illegal unit name XXX_Parser. The unit is saved under dfm_rrparser.pas. The unit name must always match the file name. This is logical, be

Re: [fpc-pascal] will be work macro with name of the unit?

2015-07-16 Thread ulrich
Dne 15.7.2015 v 11:47 Pierre Free Pascal napsal(a): {$IFDEF FPC} {$MACRO ON} {$IFNDEF XXX_} {$DEFINE XXX_:=DFM_RR} // replace prefix {$ENDIF} {$ENDIF} {$INFO compiled with XXX_} unit XXX_parser; {$mode objfpc}{$H+} interface implementation end. Macros are only expanded on who

[fpc-pascal] XML from a site

2015-07-16 Thread Chris Moody
Hi all, Currently working on an app which needs to be able to read an XML from a website. Looking at the page at http://wiki.freepascal.org/XML_Tutorial it appears there is no way to get XML directly from a URL. Do I need to pull the page down via : function GetWebPageContent(const Url: str

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Sven Barth
Am 17.07.2015 08:06 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > > On 2015-07-17 03:34, silvioprog wrote: > > TPersonDao = class(TObject) > > public > > procedure Save(APerson: TObject); > > end; > > Simply change that to the following: > > TPersonDao = class(TObject) > public

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Sven Barth
Am 17.07.2015 05:03 schrieb "silvioprog" : > Hm... and more, the 'i := 1 << 1' isn't a "more Pascal-like" syntax, IMHO. =) Definitely. I was surprised when I found out that this works (it had been added sometime in the far past to simplyfy porting of C code) and nowadays it hunts me, because it ma

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Graeme Geldenhuys
On 2015-07-17 03:34, silvioprog wrote: > TPersonDao = class(TObject) > public > procedure Save(APerson: TObject); > end; Simply change that to the following: TPersonDao = class(TObject) public procedure Save(APerson: TPerson); end; and you could have compile time validation too. Using TObjec

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread silvioprog
On Thu, Jul 16, 2015 at 5:40 PM, Sven Barth wrote: > On 16.07.2015 22:17, Maciej Izak wrote: > >> 2015-07-16 17:23 GMT+02:00 Sven Barth > >: >> >> >> Then let me tell you that generic methods will arrive in mode ObjFPC >> (and thus its syntax) first, be

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread silvioprog
On Thu, Jul 16, 2015 at 11:34 PM, silvioprog wrote: [...] ... allowing us to do core more fast ... I meant "allowing us to do code more fast". =D -- Silvio Clécio My public projects - github.com/silvioprog ___ fpc-pascal maillist - fpc-pascal@lists.

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread silvioprog
On Thu, Jul 16, 2015 at 11:34 PM, silvioprog wrote: [...] > ... // a type, for example (mistakes happen, we are human =D ) > I meant "a typo, for example". ^^' -- Silvio Clécio My public projects - github.com/silvioprog ___ fpc-pascal maillist -

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread silvioprog
On Thu, Jul 16, 2015 at 6:44 PM, Michael Van Canneyt wrote: > > On Thu, 16 Jul 2015, Maciej Izak wrote: > >> 2015-07-16 17:23 GMT+02:00 Sven Barth : >> >> Then let me tell you that generic methods will arrive in mode >> ObjFPC (and thus its syntax) first, because the Delphi syntax is a PITA

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Michael Van Canneyt
On Thu, 16 Jul 2015, Maciej Izak wrote: 2015-07-16 17:23 GMT+02:00 Sven Barth : Then let me tell you that generic methods will arrive in mode ObjFPC (and thus its syntax) first, because the Delphi syntax is a PITA to parse/handle. (in fact generic methods are already working in

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Maciej Izak
2015-07-16 22:40 GMT+02:00 Sven Barth : > var >>X: strong TDictionary, string>; >> > > Prefixed modifiers are the /worst/ you can do for Pascal. > it is already being done by introducing "specialize" keyword. I have totally different opinion :) for me it is beautiful: http://docs.elementsco

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Sven Barth
On 16.07.2015 22:17, Maciej Izak wrote: 2015-07-16 17:23 GMT+02:00 Sven Barth mailto:pascaldra...@googlemail.com>>: Then let me tell you that generic methods will arrive in mode ObjFPC (and thus its syntax) first, because the Delphi syntax is a PITA to parse/handle. (in fact gen

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Sven Barth
On 16.07.2015 21:04, Marco van de Voort wrote: In our previous episode, Sven Barth said: sadly - no, only in Delphi mode. btw. this thing keep me away from objfpc. Then let me tell you that generic methods will arrive in mode ObjFPC (and thus its syntax) first, because the Delphi syntax is a

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Sven Barth
On 16.07.2015 19:21, Michael Van Canneyt wrote: The whole generics mess that Delphi made goes completely against the Pascal dictum that you must declare something before you can use it. To me, the above verbose construction makes absolute sense. It has been so since day 1: PRecord = ^TRecord; T

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Maciej Izak
2015-07-16 17:23 GMT+02:00 Sven Barth : > Then let me tell you that generic methods will arrive in mode ObjFPC (and > thus its syntax) first, because the Delphi syntax is a PITA to parse/handle. > > (in fact generic methods are already working in mode ObjFPC in my local > repo, I just want to get

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Graeme Geldenhuys
On 2015-07-16 20:04, Marco van de Voort wrote: > > https://xkcd.com/927/ +1 Sadly that is the way the current world works. :) Regards, - Graeme - ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailma

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Marcos Douglas
On Thu, Jul 16, 2015 at 1:46 PM, Sven Barth wrote: > On 16.07.2015 17:53, Marcos Douglas wrote: >> >> [...] >> >> I didn't understand. This already works... or you talking about "work >> with the same syntax than Delphi in mode objfpc"? > > > Generic methods are not yet supported by FPC. Try the f

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Marco van de Voort
In our previous episode, Sven Barth said: > > sadly - no, only in Delphi mode. btw. this thing keep me away from objfpc. > > > > Then let me tell you that generic methods will arrive in mode ObjFPC (and > thus its syntax) first, because the Delphi syntax is a PITA to parse/handle. https://xkcd.co

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Michael Van Canneyt
On Thu, 16 Jul 2015, silvioprog wrote: On Thu, Jul 16, 2015 at 2:21 PM, Michael Van Canneyt wrote: On Thu, 16 Jul 2015, Marcos Douglas wrote: On Thu, Jul 16, 2015 at 11:44 AM, Michael Van Canneyt wrote: On Thu, 16 Jul 2015, Maciej Izak wrote

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Marcos Douglas
On Thu, Jul 16, 2015 at 1:39 PM, Sven Barth wrote: > On 16.07.2015 18:02, Marcos Douglas wrote: >> >> [...] >> >> Yes, but do you think this is more verbose unnecessarily? Because the >> syntax TFoo (I mean this "<>") show us that is a generic, don't? > > > This might be the case for a human, but

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread silvioprog
On Thu, Jul 16, 2015 at 2:21 PM, Michael Van Canneyt wrote: > On Thu, 16 Jul 2015, Marcos Douglas wrote: > >> On Thu, Jul 16, 2015 at 11:44 AM, Michael Van Canneyt >> wrote: >> >>> >>> >>> On Thu, 16 Jul 2015, Maciej Izak wrote: >>> >>> sadly - no, only in Delphi mode. btw. this thing keep me a

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Michael Van Canneyt
On Thu, 16 Jul 2015, Marcos Douglas wrote: On Thu, Jul 16, 2015 at 11:44 AM, Michael Van Canneyt wrote: On Thu, 16 Jul 2015, Maciej Izak wrote: sadly - no, only in Delphi mode. btw. this thing keep me away from objfpc. That seems like a very strange reason to me. The fact that you mu

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Sven Barth
On 16.07.2015 17:53, Marcos Douglas wrote: On Thu, Jul 16, 2015 at 12:23 PM, Sven Barth wrote: Am 16.07.2015 16:34 schrieb "Maciej Izak" : sadly - no, only in Delphi mode. btw. this thing keep me away from objfpc. Then let me tell you that generic methods will arrive in mode ObjFPC (and th

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Sven Barth
On 16.07.2015 18:02, Marcos Douglas wrote: On Thu, Jul 16, 2015 at 11:44 AM, Michael Van Canneyt wrote: On Thu, 16 Jul 2015, Maciej Izak wrote: sadly - no, only in Delphi mode. btw. this thing keep me away from objfpc. That seems like a very strange reason to me. The fact that you must

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Graeme Geldenhuys
On 2015-07-16 17:02, Marcos Douglas wrote: > Sometimes the IDE shows an error in interface declaration, but compiles. > So, to not receive these errors I have to create a new type: So, that is then a bug in Lazarus's codetools or parser - report it for the Lazarus project. Regards, - Graeme -

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Marcos Douglas
On Thu, Jul 16, 2015 at 11:44 AM, Michael Van Canneyt wrote: > > > On Thu, 16 Jul 2015, Maciej Izak wrote: > >> sadly - no, only in Delphi mode. btw. this thing keep me away from objfpc. > > > That seems like a very strange reason to me. > > The fact that you must type 1 word in certain places kee

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Graeme Geldenhuys
On 2015-07-16 16:53, Marcos Douglas wrote: > I would like to know why exists this difference, what the advantages > for mode objfpc using this syntax. Michael already answered that. "It is meant to help you, to make explicit you are in fact specializing a new type." The objfpc mode is normally m

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Marcos Douglas
On Thu, Jul 16, 2015 at 12:23 PM, Sven Barth wrote: > Am 16.07.2015 16:34 schrieb "Maciej Izak" : >> >> sadly - no, only in Delphi mode. btw. this thing keep me away from objfpc. >> > > Then let me tell you that generic methods will arrive in mode ObjFPC (and > thus its syntax) first, because the

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Sven Barth
Am 16.07.2015 16:34 schrieb "Maciej Izak" : > > sadly - no, only in Delphi mode. btw. this thing keep me away from objfpc. > Then let me tell you that generic methods will arrive in mode ObjFPC (and thus its syntax) first, because the Delphi syntax is a PITA to parse/handle. (in fact generic metho

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Michael Van Canneyt
On Thu, 16 Jul 2015, Maciej Izak wrote: sadly - no, only in Delphi mode. btw. this thing keep me away from objfpc. That seems like a very strange reason to me. The fact that you must type 1 word in certain places keeps you from using an otherwise useful mode ? This word is there for clarit

Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Maciej Izak
sadly - no, only in Delphi mode. btw. this thing keep me away from objfpc. 2015-07-16 15:34 GMT+02:00 Marcos Douglas: > Hi, > > Is there some way to write this: Best regards Maciej Izak ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org htt

[fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-16 Thread Marcos Douglas
Hi, Is there some way to write this: type generic ICloneable = interface function Clone: T; end; ...using this sintaxe: type ICloneable = interface function Clone: T; end; Because I would like to use: TFoo = class(ICloneable) ...instead use: TFoo = class(specialize ICloneable)

Re: [fpc-pascal] question with interfaces, hooks

2015-07-16 Thread Graeme Geldenhuys
On 2015-07-15 19:58, David Emerson wrote: > Any example code that shows the power of interfaces or > TAggregatedObject in a somewhat useful example? The best Interfaces usage I've ever seen was done by Joanna Carter with her MVP implementation. The articles and source code is available on my serv

Re: [fpc-pascal] question with interfaces, hooks

2015-07-16 Thread David Emerson
Thanks, Graeme and Sven! On 07/14/2015 11:05 PM, Sven Barth wrote: Not related to your problem, but important nevertheless: you don't need to free interface variables. They are reference counted and freed automatically at least if you don't mix a class reference (in your case to t_foo_base) and