Re: [fpc-pascal] Subclassing generic records?

2017-07-21 Thread Martin Schreiber
On Friday 21 July 2017 23:04:20 Ryan Joseph wrote:
> Thanks Sven, that’s one way around it.
>
> So is it by design that records don’t have inheritance or is this planned?
>
MSElang has a concept of unified record, object and class constructs. There a 
record is a simplified object which never has a VMT and has no methods. An 
object has a VMT only if the attribute [virtual] is given. An object can be 
instantiated in global or stack memory or on heap if it has a constructor() 
and destructor().
A class is an object which always is instantiated on heap and which provides 
implicit dereferencing. Classes can inherit from objects.
https://gitlab.com/mseide-msegui/mselang/wikis/home/mselang_objects
https://gitlab.com/mseide-msegui/mselang/wikis/home
(under construction).

Martin
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Subclassing generic records?

2017-07-21 Thread Sven Barth via fpc-pascal
Am 21.07.2017 23:36 schrieb "Ryan Joseph" :
>
> Thanks Sven, that’s one way around it.
>
> So is it by design that records don’t have inheritance or is this planned?

Yes, that's by design and there are no plans to change this.

> and is it also by design that classes don’t allow operator overloads
inside them? That seems like an omission since the way they’re implemented
in records is much nicer imo.

There are two points you need to be aware of to understand why thinks are
the way they are:
First of global operator overloads were the first that were implemented in
FPC. Then Delphi came along and added record operator overloads, because
they needed them for generics. FPC followed, cause the global overloads are
useless in that case.
Secondly even for global operator overloads classes are not really that
suitable, cause in complex expressions (let's say "a * (b + c)") you'll
have the generation of temporary variables (in the example the result of "b
+ c"), but the compiler can't know whether it's really a temporary value
that it can free after the whole expression is handled or whether merely
the instance that had been passed in (let's say "b") had been modified and
passed as a result. Thus operator overloads for classes can easily lead to
memory leaks or other hard to debug problems. Yes, that's already possible
with global operators as well, but with operators that are part of the
class that would be much more inviting.

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Subclassing generic records?

2017-07-21 Thread Ryan Joseph
Thanks Sven, that’s one way around it. 

So is it by design that records don’t have inheritance or is this planned? 

and is it also by design that classes don’t allow operator overloads inside 
them? That seems like an omission since the way they’re implemented in records 
is much nicer imo.

> On Jul 20, 2017, at 4:11 AM, Sven Barth via fpc-pascal 
>  wrote:
> 
> I have also another solution for your original problem. Take this code:

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Sistema grande em CGI

2017-07-21 Thread Rogério Martins
Sorry !
Wrong list.



Em 21 de julho de 2017 09:19, Sven Barth via fpc-pascal <
fpc-pascal@lists.freepascal.org> escreveu:

> Am 21.07.2017 13:33 schrieb "Rogério Martins" :
> >
> > Bom dia pessoal !
> >
> > Alguém aí já desenvolveu algum sistema grande em cgi ? (muitos acessos
> simultâneos, etc)
> >
> > Queria saber se ele dá conta, ou até onde se pode ir.
> > Eu só fiz aplicações pequenas.
> >
> > Obrigado
>
> This is an English list, so please write in English.
>
> Regards,
> Sven
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>



-- 
The Ubuntu Counter Project - user number # 33192

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Class type to package name?

2017-07-21 Thread Mattias Gaertner
On Fri, 21 Jul 2017 04:54:04 -0400
Anthony Walter  wrote:

> When I register a component with the IDE it is installed from a package.
> The package has a name. I want to know the name of the package, given a
> class type of a component registered in the IDE.

You have to search the packages.
I added a utility function to make it more comfortable:

uses packageintf;

PackageEditingInterface.FindInstalledPackageWithUnit()

Mattias

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] strutils (RTL) content missing from fp-docs in Debian package

2017-07-21 Thread Graeme Geldenhuys

On 2017-07-21 12:26, Peter wrote:

Does anyone have any thoughts on what the cause might be?


Maybe their build system used a old or broken fpdoc executable.

The StrUtils documentation does exist, as can be seen here in the 
official online version:


  https://www.freepascal.org/docs-html/rtl/strutils/index-5.html


Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Sistema grande em CGI

2017-07-21 Thread Sven Barth via fpc-pascal
Am 21.07.2017 13:33 schrieb "Rogério Martins" :
>
> Bom dia pessoal !
>
> Alguém aí já desenvolveu algum sistema grande em cgi ? (muitos acessos
simultâneos, etc)
>
> Queria saber se ele dá conta, ou até onde se pode ir.
> Eu só fiz aplicações pequenas.
>
> Obrigado

This is an English list, so please write in English.

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Static local variables available?

2017-07-21 Thread Sven Barth via fpc-pascal
Am 21.07.2017 10:44 schrieb "Santiago A." :
>
> El 20/07/2017 a las 15:50, Sven Barth via fpc-pascal escribió:
>>
>> Am 20.07.2017 13:01 schrieb "Bo Berglund" :
>> >
>> > On Thu, 20 Jul 2017 11:11:50 +0200, Maciej Izak
>> >  wrote:
>> >
>> > >2017-07-20 11:03 GMT+02:00 Bo Berglund :
>> > >
>> > >> So since I don't really want to use a global, is it possible to
>> > >> declare a local variable static in the sense that it retains its
>> > >> values across calls to the procedure?
>> > >> If so how is it done?
>> > >>
>> > >
>> > >procedure foo;
>> > >{$PUSH}
>> > >const{$J+}
>> > >  s : string ='';
>> > >{$POP}
>> >
>> > Thanks,
>> > but it looks a bit involved, probably better to use an object field
>> > variable instead only accessible from the internal methods.
>>
>> If you don't want to use $push/$pop then you can also simply enable $J+
for the whole unit. But this will also mean that global constants are
writable.
>
> Well, I'm an old dog so I prefer old fashion ways. A variable that
retains its value is, from memory point of view, a global variable. I mean,
the memory is never freed, it's not freed when it goes out of scope. So,
the problem is what to do to limit the visibility to the procedure.

Writable constants *are* the old fashion way, cause this kind of usage
stems from Turbo Pascal and allowed to restrict the visibility of symbols.

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Sistema grande em CGI

2017-07-21 Thread Rogério Martins
Bom dia pessoal !

Alguém aí já desenvolveu algum sistema grande em cgi ? (muitos acessos
simultâneos, etc)

Queria saber se ele dá conta, ou até onde se pode ir.
Eu só fiz aplicações pequenas.

Obrigado

-- 
The Ubuntu Counter Project - user number # 33192

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] strutils (RTL) content missing from fp-docs in Debian package

2017-07-21 Thread Peter
Hi,

Since fpc version 3.0 (2.6.4 was OK) the Debian docs package has no
content for strutils.

Does anyone have any thoughts on what the cause might be?


Regards,
Peter B


https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=858797
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Class type to package name?

2017-07-21 Thread Michael Van Canneyt



On Fri, 21 Jul 2017, Anthony Walter wrote:


When I register a component with the IDE it is installed from a package.
The package has a name. I want to know the name of the package, given a
class type of a component registered in the IDE.

See this issue:

https://bugs.freepascal.org/view.php?id=32182

procedure RegisterForm(const Package: string; FormClass: TCustomFormClass;
const Category, Caption, Description, Units: string);

I would like to simplify this further by omitting the Package string if it
could be computed from the FormClass parameter.


So you mean a lazarus package. 
In that case, you had better ask this on the lazarus mailing list ?


By sending the mail here, I was not sure whether you meant (future)
dynamic package support or current Lazarus package support.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Class type to package name?

2017-07-21 Thread Anthony Walter
When I register a component with the IDE it is installed from a package.
The package has a name. I want to know the name of the package, given a
class type of a component registered in the IDE.

See this issue:

https://bugs.freepascal.org/view.php?id=32182

procedure RegisterForm(const Package: string; FormClass: TCustomFormClass;
const Category, Caption, Description, Units: string);

I would like to simplify this further by omitting the Package string if it
could be computed from the FormClass parameter.

See also:

https://www.getlazarus.org/videos/dockedform/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Static local variables available?

2017-07-21 Thread Santiago A.
El 20/07/2017 a las 15:50, Sven Barth via fpc-pascal escribió:
>
> Am 20.07.2017 13:01 schrieb "Bo Berglund"  >:
> >
> > On Thu, 20 Jul 2017 11:11:50 +0200, Maciej Izak
> > > wrote:
> >
> > >2017-07-20 11:03 GMT+02:00 Bo Berglund  >:
> > >
> > >> So since I don't really want to use a global, is it possible to
> > >> declare a local variable static in the sense that it retains its
> > >> values across calls to the procedure?
> > >> If so how is it done?
> > >>
> > >
> > >procedure foo;
> > >{$PUSH}
> > >const{$J+}
> > >  s : string ='';
> > >{$POP}
> >
> > Thanks,
> > but it looks a bit involved, probably better to use an object field
> > variable instead only accessible from the internal methods.
>
> If you don't want to use $push/$pop then you can also simply enable
> $J+ for the whole unit. But this will also mean that global constants
> are writable.
>
Well, I'm an old dog so I prefer old fashion ways. A variable that
retains its value is, from memory point of view, a global variable. I
mean, the memory is never freed, it's not freed when it goes out of
scope. So, the problem is what to do to limit the visibility to the
procedure.

What about the old interface/implementation ways? You can't limit the
visibility to the procedure, but you can limit the visibility to the
implementation, so it is globally invisible.

unit hiddenVar;

interface

  procedure foo;
  procedure resetFoo;

implementation

var
 HiddenValue:integer;

procedure foo;
begin
 writeln(HiddenValue);
 inc(HiddenValue);
end;

procedure resetFoo;
begin
 HiddenValue:=0;
end;

initialization
  resetFoo;
end.


-- 
Saludos

Santiago A.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Class type to package name?

2017-07-21 Thread Michael Van Canneyt



On Thu, 20 Jul 2017, Anthony Walter wrote:


Assuming the class type has been registered either through
RegisterComponent or RegisterNoIcon, what is the most straight forward way
to get the package name it is defined in given a class type?


Define package ?

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal