* * *

Author Topic: The future of Free Pascal  (Read 79204 times)

hengky

  • New member
  • *
  • Posts: 11
Re: The future of Free Pascal
« Reply #315 on: June 01, 2017, 04:51:37 pm »
Can free pascal porting to haxe ?

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5728
Re: The future of Free Pascal
« Reply #316 on: June 01, 2017, 05:01:00 pm »
Can free pascal porting to haxe ?

If I search for Haxe, I only find some scripting language system. Did I find the wrong haxe, and is haxe some OS?

Scoops

  • Jr. Member
  • **
  • Posts: 82
Re: The future of Free Pascal
« Reply #317 on: June 01, 2017, 05:16:17 pm »
Maybe its

https://haxe.org/

the first thing google gave me
« Last Edit: June 01, 2017, 05:18:37 pm by Scoops »

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5728
Re: The future of Free Pascal
« Reply #318 on: June 01, 2017, 06:21:46 pm »
Maybe its

https://haxe.org/

the first thing google gave me

That's what I also found, which is a programming system (compiler/library) with a non native (wxwidgets) GUI, not a target afaik.  So I don't really understand how FPC is supposed to be ported to it.

sky_khan

  • Guest
Re: The future of Free Pascal
« Reply #319 on: June 01, 2017, 06:32:41 pm »
I guess either he/she meant a transcompiler to Haxe or compiling to haxe's own virtual machine target (neko). Neither of them are supported of course. There is no reason for this too, I think. Supporting all virtual machines on the world should not have been freepascal's goal.

hengky

  • New member
  • *
  • Posts: 11
Re: The future of Free Pascal
« Reply #320 on: June 21, 2017, 08:58:07 pm »
About Haxe I think we can use library from other language , if we compile haxe to Java it mean we can use SWT, AWT, Java Bean etc, haxe to php we can use library from zend

so if we compile object pascal to haxe , we can use library from other language that support haxe
it will be pascal every where

haxe compile to native language , not like .net or jvm

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5728
Re: The future of Free Pascal
« Reply #321 on: June 21, 2017, 10:27:04 pm »
About Haxe I think we can use library from other language , if we compile haxe to Java it mean we can use SWT, AWT, Java Bean etc, haxe to php we can use library from zend

so if we compile object pascal to haxe , we can use library from other language that support haxe
it will be pascal every where

haxe compile to native language , not like .net or jvm

FPC also, and has heaps of targets. Including Java. Maybe Haxe should compiler to FPC :_)

Thaddy

  • Hero Member
  • *****
  • Posts: 4505
Re: The future of Free Pascal
« Reply #322 on: June 21, 2017, 10:34:46 pm »
haxe compile to native language , not like .net or jvm

FPC also, and has heaps of targets. Including Java. Maybe Haxe should compiler to FPC :_)
And the jvm target is pretty good. And can be used to feed into a native code compiler for Java bytecode...
I started treating monkeys like monkeys some time ago. (Including myself  :D)
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

jc99

  • Hero Member
  • *****
  • Posts: 516
    • My private Site
Re: The future of Free Pascal
« Reply #323 on: June 22, 2017, 07:36:35 am »
Speaking of transpilers, how is the progress in pas2js ? Last demo on "German Lazarustreffen" seems pretty promising, so I look forward to time it's released.
« Last Edit: June 22, 2017, 08:11:42 am by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.2 - 1.6.4, 1.8rc3
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are

tr_escape

  • Sr. Member
  • ****
  • Posts: 264
  • sector name toys
    • Github:
Re: The future of Free Pascal
« Reply #324 on: June 22, 2017, 08:59:43 am »
I think (as I understand) he/she wants to say is it possible to use fpc like as haxe functions:

Code: Pascal  [Select]
  1. using StringTools;
  2.  
  3. class Test {
  4.         static public function main() {
  5.                 // uses static extension StringTools from the Haxe Standard Library
  6.                 var v = "adc".replace("d", "b");
  7.                 trace(v);
  8.         }
  9. }

For example:

Code: Pascal  [Select]
  1. function str_change:string;
  2. var
  3.   str : 'adc'.replace('d','b');
  4.   // or
  5.   str : String('adc'.replace('d','b'));
  6. begin
  7.   result := str;
  8. end;
  9.  

« Last Edit: June 22, 2017, 09:05:36 am by tr_escape »

jc99

  • Hero Member
  • *****
  • Posts: 516
    • My private Site
Re: The future of Free Pascal
« Reply #325 on: June 22, 2017, 11:59:53 am »
I think (as I understand) he/she wants to say is it possible to use fpc like as haxe functions:

Code: Haxe  [Select]
  1. using StringTools;
  2.  
  3. class Test {
  4.    static public function main() {
  5.       // uses static extension StringTools from the Haxe Standard Library
  6.       var v = "adc".replace("d", "b");
  7.       trace(v);
  8.    }
  9. }

For example:

Code: Pascal  [Select]
  1. function str_change:string;
  2. var
  3.   str : 'adc'.replace('d','b');
  4.   // or
  5.   str : String('adc'.replace('d','b'));
  6. begin
  7.   result := str;
  8. end;
  9.  

For example:

Code: Pascal  [Select]
  1. function str_change:string;
  2. var
  3.   str : 'adc'.replace('d','b'); // That is maybe difficult
  4.   // or
  5.   str : String('adc'.replace('d','b')); // Slightly better;
  6.   str : String = 'adc'.replace('d','b'); // can be done really easily;
  7. begin
  8.   result := str;
  9. end;
  10.  

I also would like to have initialized open array of String
Code: Pascal  [Select]
  1. const cText:array of string =
  2. ('Hello World',
  3.   '2. String',
  4. [...] ,
  5. 'Last String');
  6.  
Or even better:
Code: Pascal  [Select]
  1. const cText:array of string =({$I anytext.txt});
  2. {or}const cText: Tstrings.text ='{$I anytext.txt}';
  3.  
« Last Edit: June 22, 2017, 12:08:58 pm by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.2 - 1.6.4, 1.8rc3
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5728
Re: The future of Free Pascal
« Reply #326 on: June 22, 2017, 01:08:40 pm »
I don't think anything that declares and initializes with non constant values will be added. It violates too much the spirit of pascal.

The functional/pipeline   xx.yy.zz  way of concatenating string is used in TStringbuilder and various other string libraries. It is not a language feature, but a library feature.

Personally  I abhor the style. I blame it on Turbo Vision traumas, which employed this style and was IMHO pretty much unreadable.
« Last Edit: June 22, 2017, 01:29:15 pm by marcov »

wp

  • Hero Member
  • *****
  • Posts: 3795
Re: The future of Free Pascal
« Reply #327 on: June 22, 2017, 01:25:46 pm »
For example:

Code: Pascal  [Select]
  1. function str_change:string;
  2. var
  3.   str : 'adc'.replace('d','b');
  4.   // or
  5.   str : String('adc'.replace('d','b'));
  6. begin
  7.   result := str;
  8. end;
  9.  
So, since 'adc' is a literal string and the 'd' is to be replaced by a 'b' then why not simply declare it directly?
Code: Pascal  [Select]
  1. var
  2.   str: String = 'abc';
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

jc99

  • Hero Member
  • *****
  • Posts: 516
    • My private Site
Re: The future of Free Pascal
« Reply #328 on: June 22, 2017, 03:21:41 pm »
The functional/pipeline   xx.yy.zz  way of concatenating string is used in TStringbuilder and various other string libraries. It is not a language feature, but a library feature.

Personally  I abhor the style. I blame it on Turbo Vision traumas, which employed this style and was IMHO pretty much unreadable.
Personally I don't like this style too.
With One, maximum two functions in one line, it might be OK but some do it for Pages so at the end nobody knows the start. and they even call that an advantage ...
But the real trauma was the bracketed style I speak of new([..].init(new([..].init(new(... ))))))))...))))))); - Style, which is/was much worse.

The things I suggested don't violate the Constant Values only - Spirit.
Like all initialized values, the initialization (as long as it's about variable) can be seen as a hidden first assignment statment that is just moved up to the variable declaration.
What I mean:
Code: Pascal  [Select]
  1. Function XYZ:TValue;
  2.  
  3. var lVar:integer = 4 + 5;
  4.  
  5. begin
  6. [...]
Can without a los of functionality (or is internaly) replaced with
Code: Pascal  [Select]
  1. Function XYZ:TValue;
  2.  
  3. var lVar:integer;
  4.  
  5. begin
  6.   lVar := 4 + 5;
  7. [...]
So can all the other Statements prior mentioned(except for the TStrings-Variant). As long as every Parameter involved are Constants and (the Function only depend on these Parameters, (and have no Hidden Side-effects but even if they have the Coder has to know what he's doing then using these Functions ))
« Last Edit: June 22, 2017, 03:25:17 pm by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.2 - 1.6.4, 1.8rc3
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5728
Re: The future of Free Pascal
« Reply #329 on: June 22, 2017, 03:40:43 pm »
So can all the other Statements prior mentioned(except for the TStrings-Variant). As long as every Parameter involved are Constants and (the Function only depend on these Parameters, (and have no Hidden Side-effects but even if they have the Coder has to know what he's doing then using these Functions ))

That's not how it works. Only builtins can be evaluated in constant expressions, not arbitrary functions (which can be called by the compiler without knowing how it works)

People that like Functional programming should IMHO use functional languages, and not try to convert imperative languages into functional ones.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus