Delphi Programming Community Login Homepage Homepage Nederlandse website Brazilian offers Downloads from Embarcadero Homepage Lazarus website


Bad Marketing
/ 13 February 2017
PAS2JS compiler
/ 20 February 2017


PASCAL CHAT - we start redesigning our website

I have begun this blog to keep Blaise Pascal readers fully up-to-date with some recent developments as outlined below.

Bad Marketing
But first I must express my concern about Embarcadero’s marketing strategy
for the new Linux version of Delphi, which is being offered only at Enterprise level and above.
The Pascal community has always been keen on having a Linux Delphi.
However, a strategy of making money from Delphi Linux only through the most expensive versions is counterproductive since it runs against the very strength of Delphi:
it’s committed community.

I appreciate that developing a Linux Delphi has to be profitable.
But the community with its unwavering  love for Delphi,
and steady evangelising of Pascal as a programming language
doesn’t deserve to have the Linux Delphi version placed virtually beyond financial reach.
I trust that sooner or later Embarcadero will come to its senses and make it available at a level of the Professional package.

NEWS about the PAS2JS compiler
Now on to the good news: the PAS2JS compiler is almost ready for release. Mattias Gärtner, the leading pro for Lazarus and its environment has been asked to create the compiler.
We hope that within a two weeks the first testing will start, and then we will show you some results, probably in the next issue: Number 60. I think so far Mattias has done an outstanding job. Here is an outline of the work done so far, and what we think still has to be done:

Todays updated list 20/2/2017 :

- units, programs
- unit interface function
- uses list
- use $impl for implementation declarations, can be disabled
- interface vars
- implementation vars
- initialization section
- option to add "use strict";
- procedures
  - params
  - local vars
  - default values
  - function results
  - modifier external 'name'
- assign statements
- char and string literals
- string setlength
- string: read and write char aString[]
- for loop
  - if loopvar is used afterwards append  if($loopend>i)i--;
- repeat..until
- try..finally
- try..except, try..except on else
- raise, raise E
- asm..end
- assembler; asm..end;
- break
- continue
- type alias
- inc/dec to += -=
- case-of
- convert "a div b" to "Math.floor(a / b)"
- and, or, xor, not: logical and bitwise
- rename name conflicts with js identifiers: apply, bind, call, prototype, ...
- record
  - types and vars
  - assign
  - clone record member
  - clone set member
  - clone when passing as argument
- classes
  - declare using createClass
  - constructor
  - destructor
  - vars
  - class vars
  - ancestor
  - virtual, override, abstract
  - "is" operator
  - "as" operator
  - call inherited "inherited;", "inherited funcname;"
  - call class method
  - read/write class var
  - property
    - param list
    - property of type array
  - class property
    - accessors non static
  - Assigned()
  - default property
  - type casts


- arrays
  - init as "arr = []"
  - SetLength(arr,len) becomes  arr = SetLength(arr,len,defaultvalue)
  - length(arr)
  - read, write element arr[index]
  - low(), high()
  - multi dimensional [index1,index2] -> [index1][index2]
  - array of record
- enums
  - type with values and names
  - option to write numbers instead of variables
  - ord(), low(), high(), pred(), succ()
  - type cast number to enumtype
- sets
  - set of enum
  - include, exclude
  - assign :=  clone
  - constant set: enums, enum vars, ranges
  - set operators +, -, *, ><, =, <>, >=, <=
  - in-operator
  - low(), high()
  - clone when passing as argument
- with-do  using local var
  - with record do i:=v;
  - with classinstance do begin create; i:=v; f(); i:=a[]; end;
- pass by reference
  - pass local var to a var/out parameter
  - pass variable to a var/out parameter
  - pass reference to a var/out parameter
  - pass array element to a var/out parameter
- proc types
  - implemented as immutable wrapper function
  - assign := nil, proctype (not clone), @function, @method
  - call  explicit and implicit
  - compare equal and notequal with nil, proctype, address, function
  - assigned(proctype)
  - pass as argument
  - methods
  - mode delphi: proctype:=proc
  - mode delphi: functype=funcresulttype
- class-of
  - assign :=   nil, var
  - call class method
  - call constructor
  - operators =, <>
  - class var, property, method
  - Self in class method
  - typecast

- rename overloaded procs, append $0, $1, ...
- create unique id for local const
- use UTF8 string literals
- array
  - const
- record
  - const
  - equal, not equal

Maybe in Version 1.0: Probably not in Version 1.0:

- sets
  - set of char
  - set of boolean
  - set of integer range
  - set of char range
- arrays
  - static array: non 0 start index
  - static array: length
  - array of static array: setlength
  - array[char]
  - open arrays

- call array of proc element without ()
- enums custom values
- library
- option typecast checking -CR
- option range checking -Cr
- option overflow checking -Co
- option trash local vars -gt
- optimizations:
  set operators on literals without temporary arrays
  use a number for small sets
  -O1 insert local/unit vars for global type references:
      at start of intf var $r1;
      at end of impl: $r1=path;
  -O1 insert unit vars for complex literals
  -O1 no function Result var when assigned only once
- dotted unit names
- objects, interfaces, advanced records
- class helpers, type helpers, record helpers,
- generics
- operator overloading



Boian Mitov
made some great instruction videos about Arduino and Delphi

Arduino Boards

Day 1 - Rapidly customize and connect to Arduino based IoT device projects (More...)

Day 2 - Using RAD Studio, programmatically connect and configure your own IoT devices (through Bluetooth and app-tethering) (More...)

Day 3 - Build an auto-managing connected network of IoT devices that employs a unified REST API—using RAD Server and ThingPoints (More...)

Day 4 - Connect to the IoT network with your favorite programming languages, including consuming YAML into Swagger to create code for use in other languages. (More...)