Re: [fpc-pascal] cocoa programming without objective-pascal mode

2014-11-03 Thread Bee
On Mon, Nov 3, 2014 at 11:00 AM, Dmitry Boyarintsev 
skalogryz.li...@gmail.com wrote:


 Just don't bother yourself with cocoa api don't go too specific.


I don't, hence this thread. :) If want to use a TObject, I want the exact
same properties, exact same behavior, exact same declaration of TObject on
everywhere else. At least, 90% of them, with 10% is special particularly to
where TObject platform is defined. I don't care if beneath it acts as
NSObject on OSX, or WinObject on Windows, or QTObject on QT, or whatever.


On Mon, Nov 3, 2014 at 1:45 PM, Sven Barth pascaldra...@googlemail.com
wrote:


 That's because FireMonkey abstracts all those APIs for you. The LCL by
 Lazarus has the same target: no matter whether you are on Win32/64, GTK,
 Qt, Carbon, Cocoa, whatever you get the same set of APIs (the API provided
 by the LCL) and you don't (normally; bugs not withstanding) need to care
 about platform differences.


FireMonkey isn't native UI. It's custom drawn UI controls (based on
OpenGL?). That's why I left Delphi. I don't like non-native UI, except for
games.


 Even if you'd directly access Cocoa using Object Pascal means you would
 not be compatible with Object Pascal codes on other platforms. The same is
 true for Delphi by the way. They interface with Cocoa code using COM
 interfaces which are not used on the Windows platform (for this purpose).
 Two different API sets!


Why would that be? A pascal TStringList can be a NSStringArray on Cocoa, or
regular list of strings on Windows. I don't care as long as my pascal
TStringList behaves consistently on any platforms. What I do care is if I
can use TStringList on Windows, but I'm forced to use NSStringList on OSX
for the same purpose and function. I don't want that. That's why I don't
like objective-pascal dialect. *btw, the class names are just pseudo class,
you should get the point* :)


 Also using Objective Pascal does in no way mean that you can not use
 Object Pascal. You can mix them as you want and you can use Objective
 Pascal classes in Object Pascal code and vice versa (otherwise this feature
 would be rather useless).


Oh, really? I didn't know that. So, I could use objective-pascal mode on
Windows too? Including its protocol and messaging mechanism?


 So please use Objective Pascal. It will save you from quite some trouble
 to implement the APIs manually (afterall there is a reason why we
 implemented Objective Pascal).


Of course there is a reason for objective pascal existence. But should I
use it? I don't know. Unless you can give me guarantee that
objective-pascal dialect can be used on Windows and Linux as well. But if
it does, why do we bother to have objective pascal at the first place? :D

FYI, just as food for thought... I'm now considering to use RemObject's
Oxygene (another pascal variant) as it behaves almost like the way I want.
I could use the same consistent syntax on any platforms. Although I have to
know special cases where API on particular OS is very much different from
other OSes. But it's pretty rare cases. If you want to know the concept of
the language, please refer to this site:
http://www.elementswiki.com/en/Oxygene_Language

But honestly, I'd love to use FreePascal. :)

Regards,

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

Re: [fpc-pascal] cocoa programming without objective-pascal mode

2014-11-03 Thread Jonas Maebe
On 03/11/14 09:02, Bee wrote:
 If want to use a TObject, I want the
 exact same properties, exact same behavior, exact same declaration of
 TObject on everywhere else.

Then you are in luck, because that is exactly how it is today. (*)

 I don't care if beneath it acts as NSObject on OSX, or WinObject on
 Windows, or QTObject on QT, or whatever.

It will never act like any of those, beneath or otherwise.

As other people have said, use Lazarus if you want to abstract away the
APIs of GUI frameworks. If you want to directly program using Cocoa, Qt,
KDE, Win32, NativeNT or Metro, then you won't ever be able to directly
pass a TStringList to an API call in FPC on any platform.

Or...

 use RemObject's Oxygene

It doesn't do everything you summed up in your mail either, but it's
possible that it does offer transparent bridging in the specific case of
Objective-C classes (or at least for supported Cocoa classes) and e.g.
COM objects. I doubt you'll be able to directly pass Oxygene classes to
Qt API calls though.


Jonas

(*) except on the JVM platform, where it is not technically possible to
declare your own class hierarchy.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] cocoa programming without objective-pascal mode

2014-11-03 Thread Sven Barth
Am 03.11.2014 09:02 schrieb Bee bee.ogra...@gmail.com:
 On Mon, Nov 3, 2014 at 1:45 PM, Sven Barth pascaldra...@googlemail.com
wrote:


 That's because FireMonkey abstracts all those APIs for you. The LCL by
Lazarus has the same target: no matter whether you are on Win32/64, GTK,
Qt, Carbon, Cocoa, whatever you get the same set of APIs (the API provided
by the LCL) and you don't (normally; bugs not withstanding) need to care
about platform differences.


 FireMonkey isn't native UI. It's custom drawn UI controls (based on
OpenGL?). That's why I left Delphi. I don't like non-native UI, except for
games.

The non-native UI aspect isn't what's the point here. It uses
nevertheless the native API (WinAPI on Windows, Cocoa on Mac OS X, etc.)
and presents you with an abstract API that allows you to use the same code
(more or less) on all supported platforms. It's the same for the LCL, but
here with native controls (mostly).


 Even if you'd directly access Cocoa using Object Pascal means you would
not be compatible with Object Pascal codes on other platforms. The same is
true for Delphi by the way. They interface with Cocoa code using COM
interfaces which are not used on the Windows platform (for this purpose).
Two different API sets!


 Why would that be? A pascal TStringList can be a NSStringArray on Cocoa,
or regular list of strings on Windows. I don't care as long as my pascal
TStringList behaves consistently on any platforms. What I do care is if I
can use TStringList on Windows, but I'm forced to use NSStringList on OSX
for the same purpose and function. I don't want that. That's why I don't
like objective-pascal dialect. *btw, the class names are just pseudo class,
you should get the point* :)

No, a TStringList can't be a NSStringArray, because they have different
functionality. The same is true for whatever other platform specific class
or functionality you pick. And somewhere there must be tee abstraction if
one wants to share code. In case of Objective Pascal you need to have
Object Pascal code that uses the Objective Pascal classes.


 Also using Objective Pascal does in no way mean that you can not use
Object Pascal. You can mix them as you want and you can use Objective
Pascal classes in Object Pascal code and vice versa (otherwise this feature
would be rather useless).


 Oh, really? I didn't know that. So, I could use objective-pascal mode on
Windows too? Including its protocol and messaging mechanism?

In theory it would be possible, because there exists a criss platform port
of the Objective C runtime, but that is currently not supported, because
noone had the need for it yet.
But that's not what I meant. The point is: on Mac OS X the classes provided
by Objective Pascal are the system API, on Windows it's the WinAPI. They
are different API and it's not the compiler's job to abstract this, but of
the runtime library (for low-level functionality) or the GUI library (in
our case LCL or fpGui).
If you access the Objective C API manually you are basically interfacing a
C API which you wrap using Object Pascal objects. So why not instead have
these Object Pascal classes wrap the Objective Pascal classes? Because then
you don't have to worry to correctly interface with the Objective C
runtime, because the compiler does the job for you. Otherwise you need to
do all this manually which is error prone.


 So please use Objective Pascal. It will save you from quite some trouble
to implement the APIs manually (afterall there is a reason why we
implemented Objective Pascal).


 Of course there is a reason for objective pascal existence. But should I
use it? I don't know. Unless you can give me guarantee that
objective-pascal dialect can be used on Windows and Linux as well. But if
it does, why do we bother to have objective pascal at the first place? :D

I'm not giving you a guarantee, because that's not the purpose of the
Objective Pascal dialect. It's purpose is to efficiently interface with Mac
OS X's API like Delphi Interfaces were originally to efficiently interface
with COM classes on Windows.


 FYI, just as food for thought... I'm now considering to use RemObject's
Oxygene (another pascal variant) as it behaves almost like the way I want.
I could use the same consistent syntax on any platforms. Although I have to
know special cases where API on particular OS is very much different from
other OSes. But it's pretty rare cases. If you want to know the concept of
the language, please refer to this site:
http://www.elementswiki.com/en/Oxygene_Language

You may have the same language, but you nevertheless need to write
different code, because .Net, Objective C and Java all have different
restrictions and the base types are named differently.

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

Re: [fpc-pascal] cocoa programming without objective-pascal mode

2014-11-03 Thread Bee
Alright, guys. Thank you for all the informations and discussion. I got
many things to learn from all of your responses. They're all valuable to
me. I haven't yet decided which way I will choose, whether to stay with
FPC, move to Oxygene, or completely migrate to Swift. I'm still on testing
phase right now before jump into Apple platform next year. Wish me luck! :)

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

Re: [fpc-pascal] cocoa programming without objective-pascal mode

2014-11-03 Thread C Western

On 02/11/14 18:38, Felipe Monteiro de Carvalho wrote:

The Cocoa interface is advancing fast. I am even running out of known
bugs, so other people testing would be appreciated.


I have some interest in this.

Is http://wiki.lazarus.freepascal.org/Cocoa_Interface reasonably up to 
date as to how to use it (assuming trunk lazarus + fpc)?


http://wiki.lazarus.freepascal.org/Roadmap#Status_of_features_on_each_widgetset

suggests lots of stuff not implemented - should more of this be 
yellow/green?


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


[fpc-pascal] cocoa programming without objective-pascal mode

2014-11-02 Thread Bee
Hi,

Is it possible to do Cocoa GUI programming on Mac/OSX using FreePascal but
without objective-pascal mode/dialect? Just pure object pascal or delphi
mode. How do I access the Cocoa SDK (foundation, appkit, etc) from pascal
code? GUI programming without GUI IDE is fine with me as long as I could
use Cocoa SDK from pascal. I don't want to use Lazarus since it only
supports Carbon (32-bit only) which will be deprecated in the next few
years. It is also breaks one of the most important advantage of FreePascal:
cross platform language.

And, are FreePascal internal libraries (packages) e.g. fcl-web, sql-db,
etc. applicable on Mac/OSX/Cocoa 64-bit platform?

Any hints for those questions are very much appreciated. Thank you.

Regards,

-- 
-Bee-

I'm an old pascal lover who feels left alone on Apple platform because
FreePascal/Lazarus are no longer Apple friendly like they used to be.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] cocoa programming without objective-pascal mode

2014-11-02 Thread Jonas Maebe
On 02/11/14 15:43, Bee wrote:
 I'm an old pascal lover who feels left alone on Apple platform because
 FreePascal/Lazarus are no longer Apple friendly like they used to be.

How was FPC more Apple friendly in the past than it is now?


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


Re: [fpc-pascal] cocoa programming without objective-pascal mode

2014-11-02 Thread Bee
Minggu, 02 November 2014, Jonas Maebe jonas.ma...@elis.ugent.be menulis:

On 02/11/14 15:43, Bee wrote:
  I'm an old pascal lover who feels left alone on Apple platform because
  FreePascal/Lazarus are no longer Apple friendly like they used to be.

 How was FPC more Apple friendly in the past than it is now?


Do I really need to answer this? It's just my email signature. :)



-- 
-Bee

_
Sent from GMail Mobile via iPod
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] cocoa programming without objective-pascal mode

2014-11-02 Thread Jonas Maebe
On 02/11/14 16:37, Bee wrote:
 
 Minggu, 02 November 2014, Jonas Maebe jonas.ma...@elis.ugent.be
 mailto:jonas.ma...@elis.ugent.be menulis:
 
 On 02/11/14 15:43, Bee wrote:
  I'm an old pascal lover who feels left alone on Apple platform
 because
  FreePascal/Lazarus are no longer Apple friendly like they used to be.
 
 How was FPC more Apple friendly in the past than it is now?
 
 Do I really need to answer this? It's just my email signature. :)

I assume you didn't put it there in the hope that nobody would ever
notice it or ask questions about it. If you did in fact hope that, then
there are probably more effective approaches than posting it to the
fpc-pascal mailing list, where the people who are personally responsible
for this alleged degradation (or at least for not addressing it) are
subscribed.


Jonas

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


Re: [fpc-pascal] cocoa programming without objective-pascal mode

2014-11-02 Thread Felipe Monteiro de Carvalho
On Sun, Nov 2, 2014 at 3:43 PM, Bee bee.ogra...@gmail.com wrote:
 Is it possible to do Cocoa GUI programming on Mac/OSX using FreePascal but
 without objective-pascal mode/dialect? Just pure object pascal or delphi
 mode. How do I access the Cocoa SDK (foundation, appkit, etc) from pascal
 code?

It is possible, I was doing it before Objective Pascal was created.
Just use the functions in the objective-c runtime, read:

http://wiki.lazarus.freepascal.org/PasCocoa

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ObjCRuntimeRef/index.html

But I warn you that doing this is a terrible choice. Objective Pascal
is the way to go. I've been working in Objective Pascal in the LCL
Cocoa interface and it's pretty good IMHO. But if you are masochistic
you can use the runtime instead of Objective Pascal.

 I don't want to use Lazarus since it only supports Carbon (32-bit only) which 
 will be deprecated in the next few years.

The Cocoa interface is advancing fast. I am even running out of known
bugs, so other people testing would be appreciated.

 It is also breaks one of the most important advantage of FreePascal: cross 
 platform language.

I don't see how Lazarus would break cross platform. That's a wierd statement.

 I'm an old pascal lover who feels left alone on Apple platform because 
 FreePascal/Lazarus are no longer Apple friendly like they used to be.

You got the order inverted here. It is not FPC/Lazarus that are less
Apple friendly. It is Apple that is each time less Pascal friendly,
and for that matter also each time less C/C++/Java friendly. Apple
wants you to use Swift (or whatever it's called).

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


Re: [fpc-pascal] cocoa programming without objective-pascal mode

2014-11-02 Thread Sven Barth
Am 02.11.2014 15:44 schrieb Bee bee.ogra...@gmail.com:
 It is also breaks one of the most important advantage of FreePascal:
cross platform language.

How will you be cross platform if you access Cocoa directly?

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

Re: [fpc-pascal] cocoa programming without objective-pascal mode

2014-11-02 Thread Bee
On Mon, Nov 3, 2014 at 12:28 AM, Jonas Maebe jonas.ma...@elis.ugent.be
 wrote:


 I assume you didn't put it there in the hope that nobody would ever
 notice it or ask questions about it. If you did in fact hope that, then
 there are probably more effective approaches than posting it to the
 fpc-pascal mailing list, where the people who are personally responsible
 for this alleged degradation (or at least for not addressing it) are
 subscribed.


I'm sorry, Jonas. I just say what I've felt about FPC/Lazarus on Apple
platform. I didn't mean to offend anybody. That footer text is now removed.


On Mon, Nov 3, 2014 at 1:38 AM, Felipe Monteiro de Carvalho 
felipemonteiro.carva...@gmail.com wrote:


 It is possible, I was doing it before Objective Pascal was created.
 Just use the functions in the objective-c runtime, read:
 http://wiki.lazarus.freepascal.org/PasCocoa


I thought this one is deprecated.



 https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ObjCRuntimeRef/index.html

 But I warn you that doing this is a terrible choice. Objective Pascal
 is the way to go. I've been working in Objective Pascal in the LCL
 Cocoa interface and it's pretty good IMHO. But if you are masochistic
 you can use the runtime instead of Objective Pascal.


Yes, it's terrible choice. I'd like to use the Cocoa runtime in OOP way but
without the objective-pascal.


 The Cocoa interface is advancing fast. I am even running out of known
 bugs, so other people testing would be appreciated.


Can I compile Lazarus using Cocoa on Mac? Last time I tried, it failed.


 I don't see how Lazarus would break cross platform. That's a wierd
 statement.


I meant the objective-pascal dialect, not the LCL.


 You got the order inverted here. It is not FPC/Lazarus that are less
 Apple friendly. It is Apple that is each time less Pascal friendly,
 and for that matter also each time less C/C++/Java friendly. Apple
 wants you to use Swift (or whatever it's called).


No, it's not. Apple owns the whole things, the platform, the API, the
language, the IDE, the tools, the market, the device, everything. Including
brings the money to us (app developers) through its customers. Apple has
all its right to do whatever it wants. If we want to join them, we have to
do it by their rules. As simple as that.

Apple owes pascal nothing, so to be pascal friendly. If we want pascal to
be available on Apple platform, we should change pascal. Not the other way
around. And that's where I think the problem comes. The way FPC adapt
itself to Apple platform, by creating objective-pascal dialect, is so bad
that it breaks one of its most important advantage: cross platform.


On Mon, Nov 3, 2014 at 1:52 AM, Sven Barth pascaldra...@googlemail.com
wrote:

 How will you be cross platform if you access Cocoa directly?

Take a look at Delphi. From a single source code base, we can compile it
for Windows and Mac. Hardly any changes are required. But if you want to
target Mac using FPC, I believe you have to use objective-pascal to access
Cocoa API which is not compatible with Windows API. That's where the cross
platform breaks. Am I right? CMIIW.

Another example, take a look at Oxygene --another pascal language variant
by RemObjects-- is able to target OSX, iOS, .Net, Mono, and Android
natively without ruining their pascal syntax. Why can't FPC be like that? I
don't understand because I'm not a compiler guy. :)

Any explanation would be very much appreciated. Thank you.

Regards,

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

Re: [fpc-pascal] cocoa programming without objective-pascal mode

2014-11-02 Thread Dmitry Boyarintsev
On Sun, Nov 2, 2014 at 10:10 PM, Bee bee.ogra...@gmail.com wrote:


 Take a look at Delphi. From a single source code base, we can compile it
 for Windows and Mac. Hardly any changes are required. But if you want to
 target Mac using FPC, I believe you have to use objective-pascal to access
 Cocoa API which is not compatible with Windows API. That's where the cross
 platform breaks. Am I right? CMIIW.

 Another example, take a look at Oxygene --another pascal language variant
 by RemObjects-- is able to target OSX, iOS, .Net, Mono, and Android
 natively without ruining their pascal syntax. Why can't FPC be like that? I
 don't understand because I'm not a compiler guy. :)


If you code using LCL APIs only then you'll achieve the desired effect:
* you'll get an application that can compile on different platforms without
any code changes (write once, compile anywhere)
* you won't need to use objective-pascal code.

Just don't bother yourself with cocoa api don't go too specific.

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

Re: [fpc-pascal] cocoa programming without objective-pascal mode

2014-11-02 Thread Sven Barth

On 03.11.2014 04:10, Bee wrote:

On Mon, Nov 3, 2014 at 1:52 AM, Sven Barth pascaldra...@googlemail.com
mailto:pascaldra...@googlemail.com wrote:

How will you be cross platform if you access Cocoa directly?

Take a look at Delphi. From a single source code base, we can compile it
for Windows and Mac. Hardly any changes are required. But if you want to
target Mac using FPC, I believe you have to use objective-pascal to
access Cocoa API which is not compatible with Windows API. That's where
the cross platform breaks. Am I right? CMIIW.

Another example, take a look at Oxygene --another pascal language
variant by RemObjects-- is able to target OSX, iOS, .Net, Mono, and
Android natively without ruining their pascal syntax. Why can't FPC be
like that? I don't understand because I'm not a compiler guy. :)

Any explanation would be very much appreciated. Thank you.


That's because FireMonkey abstracts all those APIs for you. The LCL by 
Lazarus has the same target: no matter whether you are on Win32/64, GTK, 
Qt, Carbon, Cocoa, whatever you get the same set of APIs (the API 
provided by the LCL) and you don't (normally; bugs not withstanding) 
need to care about platform differences.


Even if you'd directly access Cocoa using Object Pascal means you would 
not be compatible with Object Pascal codes on other platforms. The same 
is true for Delphi by the way. They interface with Cocoa code using COM 
interfaces which are not used on the Windows platform (for this 
purpose). Two different API sets!


Also using Objective Pascal does in no way mean that you can not use 
Object Pascal. You can mix them as you want and you can use Objective 
Pascal classes in Object Pascal code and vice versa (otherwise this 
feature would be rather useless).


So please use Objective Pascal. It will save you from quite some trouble 
to implement the APIs manually (afterall there is a reason why we 
implemented Objective Pascal).


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