[fpc-devel] [SOLVED] MIPS big-endian program starts but does nothing

2014-09-24 Thread Reinier Olislagers
On 06/09/2014 11:26, Reinier Olislagers wrote:
> Periodically I try to cross-compile a simple program [1] for my router
> with fpc trunk.

Recap: mips big endian, no FPU (openwrt router). Test program hung.

Thanks to commits in trunk between my last test and now, the sample
program below works.
-Tlinux -Pmips -CpMIPS32R2 -gw2 -g -CfSOFT

Thanks, everyone! Now for some more complicated programs and perhaps
I'll be back ;)

program hellomips;

{$mode objfpc}
{$H+}

{not$DEFINE UseCThreads} //otherwise it seems we get pthreads which gdb
can't debug

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Sysutils, Classes
  ;

begin
  writeln('hello mips');
end.

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


Re: [fpc-devel] Suggestion: reference counted objects

2014-09-24 Thread Dmitry Boyarintsev
On Tue, Sep 23, 2014 at 10:47 PM, Boian Mitov  wrote:

>   Hmm... I have serious doubt the anonymous methods (actually referenced
> objects as previously discussed) will be discouraged.
> If anything they are more and more used across the majority of the
> languages, as they have huge advantages.
>
Just like "goto" operator was available in the majority of the langauges,
back in a days. And it's still there!
Don't get me wrong, I'm just sharing my thoughts, rather than trying to
discourage you from using it.


> We have converted the majority of our code to use them in the last 2
> years, and that reduced the code to 1/4 of the original size.
> All new code we write in my company is 100% anonymous methods centric.
>

How about the maintenance cost?
Is it now easier-faster-safer to bring changes into the code without
introducing regressions?


thanks,
Dmitry
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Suggestion: reference counted objects

2014-09-24 Thread Boian Mitov
Extremely easy.
We made the decision after discovering how much easier the code is to maintain 
and grow. We have sped up our development by a factor of more than 3 times, and 
we have reduced maintenance issues by approximately 6 times.
As I said, the future will show who was on the right track ;-) .
I have the feeling you think anonymous methods are just methods without a name, 
that is not the case at all (just the syntax is like that), so that is probably 
why you underestimate their power.
If you are interested to learn what makes them so enormously powerful, you can 
watch my session of functional programming on the last CodeRage. But there are 
also plenty of other resources.

With best regards,
Boian Mitov

---
Mitov Software
www.mitov.com
---

From: Dmitry Boyarintsev 
Sent: Wednesday, September 24, 2014 5:26 AM
To: FPC developers' list 
Subject: Re: [fpc-devel] Suggestion: reference counted objects

How about the maintenance cost?
Is it now easier-faster-safer to bring changes into the code without 
introducing regressions?



thanks,
Dmitry


 





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


Re: [fpc-devel] Suggestion: reference counted objects

2014-09-24 Thread Nikolay Nikolov

On 09/23/2014 08:47 PM, Boian Mitov wrote:

This is a valid point.
The only downside is that the object will every time do a deep copy 
versus a shallow (pointer only) copy. Deep copy is very, very 
expensive operation.
Adding ref. counting to objects is probably equivalent of one 
interlocked assembly instruction, so a very small difference, probably 
not even measurable.
Copy of a large object can take a large memory transfer, and will also 
reserve memory for each copy, thus significantly increasing memory.
While both approaches have something going for them, they are not 
total subside for each other.
Yes, but if you have compiler support for objects with automatic calls 
of constructors/destructor/copy constructor/assignment operator (like in 
C++ classes), and if you also have generics support for objects, you can 
make a generic smart pointer object type that adds reference counting to 
any class. And then the regular class references will serve as weak 
references. Exactly like C++:


http://www.boost.org/doc/libs/1_56_0/libs/smart_ptr/smart_ptr.htm

What's more important is that we can extend objects this way, without 
breaking backward compatibility. But, unfortunately, it's a huge 
slippery slope from there, as anyone, who has dealt with C++ STL error 
messages knows:


http://pascalg.wordpress.com/2008/02/24/stl-error-messages-are-so-great/

Nikolay

With best regards,
Boian Mitov

---
Mitov Software
www.mitov.com
---
*From:* August Oktobar 
*Sent:* Tuesday, September 23, 2014 10:35 AM
*To:* FPC developers' list 
*Subject:* Re: [fpc-devel] Suggestion: reference counted objects
To somebody (probably Sven):

In FPC there is concept of stack based objects (object) that behave 
like classes (with inheritance)?
Why not just extend this object with support for constructors and 
destructors, and there is no need for the ARC?
On Mon, Sep 22, 2014 at 2:05 PM, Hans-Peter Diettrich 
mailto:drdiettri...@aol.com>> wrote:


Sven Barth schrieb:

Am 22.09.2014 09:47 schrieb "Michael Schnell"
mailto:mschn...@lumino.de>


> Why not use "interface" to add ref-counting to an object ?
This seems to work nicely even though the name "interface" in
not "speaking" on that behalf.

Because you'll need to declare an interface for each class you
want to have reference counted so that you can access its
methods, properties, etc.


This overhead could be eliminated by another syntax extension, like
  TMyARCclass = interface(TObject)
where the Compiler could allow for implementations of the declared
methods just as for
  TMyARCclass = class(TObject)
bridging the gap between traditional (strictly declarative)
interfaces and classes (including implementations), with or
without ARC.

DoDi

___
fpc-devel maillist  - fpc-devel@lists.freepascal.org

http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


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


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


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


Re: [fpc-devel] Suggestion: reference counted objects

2014-09-24 Thread Boian Mitov
100% agree, although although smart pointers also can already be implemented in 
Delphi with anonymous methods.
I wanted to mention the possibility actually in my post.
For good smart pointer however we also will need implicit casting, operator 
overloading and few other features, but it surely is an option.
As for STL, we actually already have implemented some aspects of it in 
Mitov.Runtime (Free library) for Delphi, and will be doing more.
I am huge fan of STL/boost and the concept based development, and I use some 
aspects of it even in Delphi (to the extend the language and the generics 
allow).

With best regards,
Boian Mitov

---
Mitov Software
www.mitov.com
---

From: Nikolay Nikolov 
Sent: Wednesday, September 24, 2014 3:34 PM
To: fpc-devel@lists.freepascal.org 
Subject: Re: [fpc-devel] Suggestion: reference counted objects

On 09/23/2014 08:47 PM, Boian Mitov wrote:

  This is a valid point.
  The only downside is that the object will every time do a deep copy versus a 
shallow (pointer only) copy. Deep copy is very, very expensive operation.
  Adding ref. counting to objects is probably equivalent of one interlocked 
assembly instruction, so a very small difference, probably not even measurable.
  Copy of a large object can take a large memory transfer, and will also 
reserve memory for each copy, thus significantly increasing memory.
  While both approaches have something going for them, they are not total 
subside for each other.
Yes, but if you have compiler support for objects with automatic calls of 
constructors/destructor/copy constructor/assignment operator (like in C++ 
classes), and if you also have generics support for objects, you can make a 
generic smart pointer object type that adds reference counting to any class. 
And then the regular class references will serve as weak references. Exactly 
like C++:

http://www.boost.org/doc/libs/1_56_0/libs/smart_ptr/smart_ptr.htm

What's more important is that we can extend objects this way, without breaking 
backward compatibility. But, unfortunately, it's a huge slippery slope from 
there, as anyone, who has dealt with C++ STL error messages knows:

http://pascalg.wordpress.com/2008/02/24/stl-error-messages-are-so-great/

Nikolay___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel