Re: [fpc-pascal] Primitive Record Wrappers

2016-02-29 Thread Mazola Winstrol
2016-02-27 14:58 GMT-03:00 silvioprog :

>
> $MODE DELPHI implies {$H ON}
> , so so you
> should remove the {$H+}.
>
>
Thanks for the tip! i will remove for the next version.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Primitive Record Wrappers

2016-02-29 Thread Mazola Winstrol
I have noticed that, by using generics, we can't overload arithmetic
operators.

E.g.:

...
class operator Negative(A: TNullableType): T;
...

class operator TNullableType.Negative(A: TNullableType): T;
begin
Result := -1 * A;
end;


wouldn't compile with the error "Operator not applicable to this operand
type".

Is there any workaround to overcome this?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Primitive Record Wrappers

2016-02-29 Thread Sven Barth
Am 29.02.2016 16:13 schrieb "Mazola Winstrol" :
>
> I have noticed that, by using generics, we can't overload arithmetic
operators.
>
> E.g.:
>
> ...
> class operator Negative(A: TNullableType): T;
> ...
>
> class operator TNullableType.Negative(A: TNullableType): T;
> begin
> Result := -1 * A;
> end;
> 
>
> wouldn't compile with the error "Operator not applicable to this operand
type".
>
> Is there any workaround to overcome this?

As far as I am concerned that *should* work. If it does not, then it's a
bug. Please file a bug report with a simple example program.

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

[fpc-pascal] Wiki (image) uploading temporarily disabled

2016-02-29 Thread Jonas Maebe

Hi,

The tech support scammers discovered that mediawiki's antispam regex  
doesn't get applied to image descriptions, so they're now attacking us  
that way. I hope to find a way to block this new attack angle tonight  
or tomorrow, but until then I've disabled uploading to the wiki for now.


Sorry for the inconvenience.


Jonas

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


Re: [fpc-pascal] Codepage + class helper raises "Error identifier idents no member ..."

2016-02-29 Thread silvioprog
On Sat, Feb 27, 2016 at 10:13 AM, Bart  wrote:

> On 2/27/16, Sven Barth  wrote:
>
> > That definitely shouldn't be the case. Please report.
>
> Done.
> http://bugs.freepascal.org/view.php?id=29745


Thank you! :-)

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

Re: [fpc-pascal] Primitive Record Wrappers

2016-02-29 Thread Mazola Winstrol
2016-02-29 13:16 GMT-03:00 Sven Barth :

> Am 29.02.2016 16:13 schrieb "Mazola Winstrol" :
> >
> > I have noticed that, by using generics, we can't overload arithmetic
> operators.
> >
> > E.g.:
> >
> > ...
> > class operator Negative(A: TNullableType): T;
> > ...
> >
> > class operator TNullableType.Negative(A: TNullableType): T;
> > begin
> > Result := -1 * A;
> > end;
> > 
> >
> > wouldn't compile with the error "Operator not applicable to this operand
> type".
> >
> > Is there any workaround to overcome this?
>
> As far as I am concerned that *should* work. If it does not, then it's a
> bug. Please file a bug report with a simple example program.
>
> Regards,
> Sven
>
I apologize, it works.


There is a problem in my design. The code won't compile if i try to
specialize with a type which doesn'y supports arithmetic operators e.g
String types.


 code 

{$mode delphi}

  TNullableType = record
  private
FValue: T;
  public
class operator Negative(A: TNullableType): T;
  end;

  TString = TNullableType;

.

class operator TNullableType.Negative(A: TNullableType): T;
begin
  Result := -1 * A.FValue;
end;


=== code 

Compilation error: "Operator is not overloaded: "ShortInt" * "AnsiString" ";


Is there any way to overcome this? Is there any way to tell the compiler to
ignore some operators depending on the specialization type?

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

Re: [fpc-pascal] Primitive Record Wrappers

2016-02-29 Thread wkitty42

On 02/29/2016 10:08 PM, Mazola Winstrol wrote:

There is a problem in my design. The code won't compile if i try to
specialize with a type which doesn'y supports arithmetic operators e.g String
types.


apparently i'm missing something... why should arithmetic operators be 
recognized for strings? that doesn't make sense? arithmetic operators are for 
numerics not strings...


--
 NOTE: No off-list assistance is given without prior approval.
   *Please keep mailing list traffic on the list* unless
   private contact is specifically requested and granted.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal