Re: [fpc-pascal] Are the TEncoding singletons thread-safe?

2016-08-11 Thread Bart
On 8/11/16, silvioprog  wrote:

> ... so I decided to research how Delphi
> implements it, because I can't get any error on it, and I've seen it
> implements a "lock-free initialization" technique
>  using the XE's
> AtomicCmpExchange() function before return any TEncoding global instance.
..
> I could send a patch to solve it,

I hope you did not look at the Delphi sourcecode to see how it was
implemented, because that would now make a "clean room" implementation
on our side almost impossible.

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


Re: [fpc-pascal] Are the TEncoding singletons thread-safe?

2016-08-11 Thread Jonas Maebe
Bart wrote:
> On 8/11/16, silvioprog  wrote:
> 
>> ... so I decided to research how Delphi
>> implements it, because I can't get any error on it, and I've seen it
>> implements a "lock-free initialization" technique
>>  using the XE's
>> AtomicCmpExchange() function before return any TEncoding global instance.
> ..
>> I could send a patch to solve it,
> 
> I hope you did not look at the Delphi sourcecode to see how it was
> implemented, because that would now make a "clean room" implementation
> on our side almost impossible.

It would make a clean room implementation by Silvio himself impossible,
but anyone that reads his description and writes code based on that
description is still clean (as long as they did not also look at the
Delphi source code).


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


Re: [fpc-pascal] Are the TEncoding singletons thread-safe?

2016-08-11 Thread silvioprog
On Thu, Aug 11, 2016 at 5:02 AM, Jonas Maebe 
wrote:

> Bart wrote:
> > On 8/11/16, silvioprog  wrote:
> >
> >> ... so I decided to research how Delphi
> >> implements it, because I can't get any error on it, and I've seen it
> >> implements a "lock-free initialization" technique
> >>  using the XE's
> >> AtomicCmpExchange() function before return any TEncoding global
> instance.
> > ..
> >> I could send a patch to solve it,
> >
> > I hope you did not look at the Delphi sourcecode to see how it was
> > implemented, because that would now make a "clean room" implementation
> > on our side almost impossible.
>
> It would make a clean room implementation by Silvio himself impossible,
> but anyone that reads his description and writes code based on that
> description is still clean (as long as they did not also look at the
> Delphi source code).


I've opened a new issue sending a possible patch: http://bugs.freepascal.
org/view.php?id=30462.

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

Re: [fpc-pascal] Are the TEncoding singletons thread-safe?

2016-08-11 Thread Jonas Maebe

On 11/08/16 15:17, silvioprog wrote:

I've opened a new issue sending a possible
patch: http://bugs.freepascal.org/view.php?id=30462
.


Did you look at the Delphi source code for TEncoding?


Jonas

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


Re: [fpc-pascal] Are the TEncoding singletons thread-safe?

2016-08-11 Thread silvioprog
On Thu, Aug 11, 2016 at 10:21 AM, Jonas Maebe 
wrote:

> On 11/08/16 15:17, silvioprog wrote:
>
>> I've opened a new issue sending a possible
>> patch: http://bugs.freepascal.org/view.php?id=30462
>> .
>>
>
> Did you look at the Delphi source code for TEncoding?


No, I didn't. Sorry if I made some misunderstood, I look at Delphi source
just for check why it doesn't raise memory leak, I'm fully against piracy!
I look at other sources from another languages too, like DotGNU Encoding,
but just for analysis. The proposed possible patch is 100% genuine FPC
implementation, and unlike Delphi, I've used a plain critical section for
cross platform purposes.

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

Re: [fpc-pascal] Are the TEncoding singletons thread-safe?

2016-08-11 Thread Jonas Maebe

On 11/08/16 15:38, silvioprog wrote:

No, I didn't. Sorry if I made some misunderstood, I look at Delphi
source just for check why it doesn't raise memory leak, I'm fully
against piracy! I look at other sources from another languages too, like
DotGNU Encoding, but just for analysis. The proposed possible patch is
100% genuine FPC implementation, and unlike Delphi, I've used a plain
critical section for cross platform purposes.


How do you know that Delphi doesn't use a critical section if you did 
not look at its source code?



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


Re: [fpc-pascal] Are the TEncoding singletons thread-safe?

2016-08-11 Thread silvioprog
On Thu, Aug 11, 2016 at 11:07 AM, Jonas Maebe 
wrote:

> On 11/08/16 15:38, silvioprog wrote:
>
>> No, I didn't. Sorry if I made some misunderstood, I look at Delphi
>> source just for check why it doesn't raise memory leak, I'm fully
>> against piracy! I look at other sources from another languages too, like
>> DotGNU Encoding, but just for analysis. The proposed possible patch is
>> 100% genuine FPC implementation, and unlike Delphi, I've used a plain
>> critical section for cross platform purposes.
>>
>
> How do you know that Delphi doesn't use a critical section if you did not
> look at its source code?


Now I understand what you meant. When you asked me if I looked at Delphi's
code I thought you were suggesting that I had written the patch based on it
to make a kind of copy, if so, I haven't. But if the question is about
looking at Delphi code, yes, I do, I bought a professional Delphi copy and
its license allows me to see any unit that they've sent me. Finally, I can
analyse any code of any tool if its license allows me, can't I?

Well, to avoid more confusion I'll not send more patches to solve this
problem and I'm going to close my issue.

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] Are the TEncoding singletons thread-safe?

2016-08-11 Thread Jonas Maebe

On 11/08/16 17:06, silvioprog wrote:

Now I understand what you meant. When you asked me if I looked at
Delphi's code I thought you were suggesting that I had written the patch
based on it to make a kind of copy, if so, I haven't. But if the
question is about looking at Delphi code, yes, I do, I bought a
professional Delphi copy and its license allows me to see any unit that
they've sent me. Finally, I can analyse any code of any tool if its
license allows me, can't I?


Yes, but we cannot integrate any code that has been written by you based 
on the Delphi code you looked at, because the license does not allow you 
to rewrite that code into something that is licensed under the GPLv2 or 
later.


While in theory the issue is not as black and white (there is no 
definition in copyright of when exactly a work is independent and when 
it is derivative), to be on the safe side we do not accept code that has 
been written by someone after they looked at the Delphi code for the 
same functionality.



Well, to avoid more confusion I'll not send more patches to solve this
problem and I'm going to close my issue.


I have simply removed your code from the bug report, that is enough. 
Your description of how to fix it does not pose any problems.



Jonas

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


Re: [fpc-pascal] Are the TEncoding singletons thread-safe?

2016-08-11 Thread silvioprog
On Thu, Aug 11, 2016 at 12:54 PM, Jonas Maebe 
wrote:
>
> Yes, but we cannot integrate any code that has been written by you based
> on the Delphi code you looked at, because the license does not allow you to
> rewrite that code into something that is licensed under the GPLv2 or later.
>
While in theory the issue is not as black and white (there is no definition
> in copyright of when exactly a work is independent and when it is
> derivative), to be on the safe side we do not accept code that has been
> written by someone after they looked at the Delphi code for the same
> functionality.


I understood and agreed.

But now I have a question: many Free Pascal programmers are Delphi
programmers too, having code that can be compiled in both compilers, and
sometimes they need to debug deeply, entering into the compiler code and
looking at it, so, can't a programmer contribute with Free Pascal in that
situation? If so, I have no more questions.

Well, to avoid more confusion I'll not send more patches to solve this
>> problem and I'm going to close my issue.
>>
>
> I have simply removed your code from the bug report, that is enough. Your
> description of how to fix it does not pose any problems.


No problem. 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] Are the TEncoding singletons thread-safe?

2016-08-11 Thread Jonas Maebe

On 11/08/16 20:25, silvioprog wrote:

But now I have a question: many Free Pascal programmers are Delphi
programmers too, having code that can be compiled in both compilers, and
sometimes they need to debug deeply, entering into the compiler code and
looking at it, so, can't a programmer contribute with Free Pascal in
that situation? If so, I have no more questions.


The compiler code is no problem, since the Delphi compiler code is not 
open source. For the RTL: if they looked at parts of the Delphi RTL 
source code, then they cannot contribute to the same functionality in 
the FPC RTL.



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


Re: [fpc-pascal] Are the TEncoding singletons thread-safe?

2016-08-11 Thread silvioprog
On Thu, Aug 11, 2016 at 3:33 PM, Jonas Maebe 
wrote:

> On 11/08/16 20:25, silvioprog wrote:
>
>> But now I have a question: many Free Pascal programmers are Delphi
>> programmers too, having code that can be compiled in both compilers, and
>> sometimes they need to debug deeply, entering into the compiler code and
>> looking at it, so, can't a programmer contribute with Free Pascal in
>> that situation? If so, I have no more questions.
>>
>
> The compiler code is no problem, since the Delphi compiler code is not
> open source. For the RTL: if they looked at parts of the Delphi RTL source
> code, then they cannot contribute to the same functionality in the FPC RTL.


Hm... now I understood and fully agreed. Since Delphi's TEncoding is part
of its RTL and I've looked at its implementation to understand why I can't
get leaks compiling my code using it, and there is no definition in
copyright of when exactly a work is independent and when it is derivative,
so anything I do can be understood as rewrite.

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

Re: [fpc-pascal] Are the TEncoding singletons thread-safe?

2016-08-11 Thread Marcos Douglas
On Thu, Aug 11, 2016 at 3:33 PM, Jonas Maebe  wrote:
> On 11/08/16 20:25, silvioprog wrote:
>>
>> But now I have a question: many Free Pascal programmers are Delphi
>> programmers too, having code that can be compiled in both compilers, and
>> sometimes they need to debug deeply, entering into the compiler code and
>> looking at it, so, can't a programmer contribute with Free Pascal in
>> that situation? If so, I have no more questions.
>
>
> The compiler code is no problem, since the Delphi compiler code is not open
> source. For the RTL: if they looked at parts of the Delphi RTL source code,
> then they cannot contribute to the same functionality in the FPC RTL.

A question:
If FPC use the same names, Classes and methods, how we know if a patch
was or not a copy?

Best regards,
Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Are the TEncoding singletons thread-safe?

2016-08-11 Thread Jonas Maebe

On 11/08/16 21:17, Marcos Douglas wrote:

If FPC use the same names, Classes and methods, how we know if a patch
was or not a copy?


We ask in case of doubt.


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


Re: [fpc-pascal] Are the TEncoding singletons thread-safe?

2016-08-11 Thread Marcos Douglas
On Thu, Aug 11, 2016 at 4:29 PM, Jonas Maebe  wrote:
> On 11/08/16 21:17, Marcos Douglas wrote:
>>
>> If FPC use the same names, Classes and methods, how we know if a patch
>> was or not a copy?
>
>
> We ask in case of doubt.

Understood, just for the record.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal