Recent

Author Topic: When hackers talk Truth on Pascal  (Read 6223 times)

sam707

  • Guest
When hackers talk Truth on Pascal
« on: February 22, 2018, 06:23:29 am »
https://news.ycombinator.com/item?id=15490345

interesting above link! (conversation on hackers news forum, 4 months ago)

to me, I use Object Pascal also because there are many decompilers for "C"'ish craps, so I feel more secure when I decide to publish apps (especially after a double compilation -WPO -O3 optimized)

are there other reasons (than the above hakers' forum link) that make you use/enjoy Object Pascal against others?
« Last Edit: February 22, 2018, 06:26:43 am by sam707 »

Thaddy

  • Hero Member
  • *****
  • Posts: 14157
  • Probably until I exterminate Putin.
Re: When hackers talk Truth on Pascal
« Reply #1 on: February 22, 2018, 09:04:54 am »
I already disagreed with that at the time. Now even more so.
Modern Pascal has evolved a *lot* more over the years than C has and the languages are still quite similar in CS terms.
Think of modern Pascal as C with proper gun controls in place.. C is still consistent with the second amendment of the U.S. constitution:

Everyone has the right to shoot themselves in the foot and that should be easy to do, not made harder...

Everything you can do in C you can do in Pascal too, but modern Pascal has many features to prevent you from using a gun in the first place. Saves lot's of feet...

European style and considered opinion versus thoughtless brashesness and impulsive nature of people from the land of  The Donald.

Not to mention the fact that in Pascal everything C is a comment... 8-)   ... Maybe FPC therefor supports nested comments? :P
« Last Edit: February 22, 2018, 09:44:45 am by Thaddy »
Specialize a type, not a var.

guest60499

  • Guest
Re: When hackers talk Truth on Pascal
« Reply #2 on: February 22, 2018, 12:33:02 pm »
I like Object Pascal because it reads well and elegant in its presentation of the program. Sadly, FPC/Lazarus have hard to use, flat namespacing systems, but I suppose this is no worse than C.

It seems like Object Pascal is still lacking some intertia, making it hard to use. I spent a lot of time getting things working with FPC/Lazarus, and then getting them working.

The internals of FPC seem very approachable, and FPC supports many architectures. I hope Object Pascal increases in popularity. At the same time, I am personally looking for a compiler that is suitable for formal verification, and due to this, work on one not designed for it seems a waste of time.

There are some "killer features" like anonymous procedures or functions that have not been implemented. It seems like development has slowed.

sam707

  • Guest
Re: When hackers talk Truth on Pascal
« Reply #3 on: February 22, 2018, 04:27:02 pm »
@guest namespaces where invented in C++ to ease teams around code, each one stamping their own work that way.

In Object Pascal world you can encapsulate object types inside object types so when you deliver code to a team,  your team can consider eachother units as blackboxes with public handful plugs

e.g. : sharing ONE public type containing all needed subtypes

Code: Pascal  [Select][+][-]
  1. TYPE
  2.  
  3.   TServer = class(TComponent)
  4.   private
  5.     type
  6.     TClient = class;
  7.     TCBag = specialize TFPGList<TClient>;
  8.     { TClient }
  9.  
  10.     TClient = class(TThread)
  11.     private
  12.       FSocket: TTCPBlockSocket;
  13.       FRefBag: TCBag;
  14.       FCChange: TCountProc;
  15.       procedure UpdCount;
  16.     protected
  17.       procedure BagRemove(Sender: TObject);
  18.     public
  19.       procedure Execute; override;
  20.       constructor Create(var inBag: TCBag; socket: TSocket;
  21.         CountProc: TCountProc); virtual;
  22.       destructor Destroy; override;
  23.     end;
  24.  
  25.     { TListener }
  26.     TListener = class(TThread)
  27.     private
  28.       FIpv6: boolean;
  29.       FPort: word;
  30.       FMaxConn: word;
  31.     protected
  32.       FCChange: TCountProc;
  33.     public
  34.       procedure Execute; override;
  35.       constructor Create(port, maxcx: word; ipv6: boolean;
  36.         CountProc: TCountProc); virtual;
  37.     end;
  38.  
  39.   private
  40.   var
  41.     FPort: word;
  42.     FMaxConn: word;
  43.     FIpv6: boolean;
  44.     FOnActiveChange: TNotifyEvent;
  45.     FOnClientsCount: TCountProc;
  46.  
  47.     Listener: TListener;
  48.  
  49.     function GetActive: boolean;
  50.     procedure SetActive(Value: boolean);
  51.     procedure SetMaxConn(Value: word);
  52.     procedure SetPort(Value: word);
  53.     procedure SetIpv6(Value: boolean);
  54.     procedure EndListen(Sender: TObject); virtual;
  55.     procedure SetOnStartStop(Value: TNotifyEvent);
  56.     procedure SetOnCount(Value: TCountProc);
  57.     function GetCCount: word;
  58.   public
  59.     constructor Create(AOwner: TComponent); override;
  60.     property OnClientsCount: TCountProc read FOnClientsCount write SetOnCount;
  61.   published
  62.     property Port: word read FPort write SetPort;
  63.     property Active: boolean read GetActive write SetActive;
  64.     property MaxClients: word read FMaxConn write SetMaxConn;
  65.     property Ipv6: boolean read FIpv6;
  66.     property OnActiveChange: TNotifyEvent read FOnActiveChange write SetOnStartStop;
  67.     property ClientsCount: word read GetCCount;
  68. ...
  69. ...
  70.  

My coworkers team can only use/access TServer Class, I am responsible of the whole SubTypes!
it is my space (namespace)!
to me, it is enough, use of C++ style namespace was damn anoying most of the time, useless even

constructor TServer.TListener.Create(......
begin
....
end;
....
-----
using namespace alfred {
void EinsteinIsDefNotBackInC();
}
 :P
« Last Edit: February 22, 2018, 04:57:35 pm by sam707 »

sam707

  • Guest
Re: When hackers talk Truth on Pascal
« Reply #4 on: February 22, 2018, 04:33:38 pm »
you can NOT consider C++ as modular (Object Pascam is!!!), because a header file is not necessary associated with one only implementation file, and an implementation is not necessary associated with one only header in C

let say C, C++ are messy craps with no true structured concepts, but some sort of pale mimics to them with guidelines only

Strong Typed Pascal language can not bring you to well knows C++ Death Diamond of multiple inheritances, and makes you structure your mind where messy weak languages loose you
« Last Edit: February 22, 2018, 04:52:57 pm by sam707 »

ASerge

  • Hero Member
  • *****
  • Posts: 2212
Re: When hackers talk Truth on Pascal
« Reply #5 on: February 22, 2018, 05:06:10 pm »
you can NOT consider C++ as modular (Object Pascam is!!!), because a header file is not necessary associated with one only implementation file, and an implementation is not necessary associated with one only header in C
As far as I know, in the standard C++ v.17 modules were added (C++ lovers finally realized the merits of the modules  :D).

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: When hackers talk Truth on Pascal
« Reply #6 on: February 22, 2018, 07:03:59 pm »
Pascal uses namespaces since Turbo Pascal introduced UNITs. ;D Each unit implements its own namespace.  That allows to repeat identifiers in each unit and identify each one.  That's why I was against adding "namespaces" to FPC:
Code: Pascal  [Select][+][-]
  1. UNIT ExampleUnit;
  2.  
  3. INTERFACE
  4.  
  5.   VAR
  6.      Variable: INTEGER;
  7.  
  8. IMPLEMENTATION
  9. END.
  10.  

Code: Pascal  [Select][+][-]
  1. UNIT OtherUnit;
  2.  
  3. INTERFACE
  4.  
  5.   VAR
  6.      Variable: INTEGER;
  7.  
  8. IMPLEMENTATION
  9. END.
  10.  

Code: Pascal  [Select][+][-]
  1. PROGRAM TheProgram
  2.  
  3.   USES
  4.     ExampleUnit, OtherUnit;
  5.  
  6. BEGIN
  7.   ExampleUnit.Variable := 1;
  8.   OtherUnit.Variable := 2;
  9.   WriteLn (ExampleUnit.Variable);
  10.   WriteLn (OtherUnit.Variable)
  11. END.
  12.  
« Last Edit: February 22, 2018, 07:06:12 pm by Ñuño_Martínez »
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

sam707

  • Guest
Re: When hackers talk Truth on Pascal
« Reply #7 on: February 22, 2018, 07:04:19 pm »
you can NOT consider C++ as modular (Object Pascam is!!!), because a header file is not necessary associated with one only implementation file, and an implementation is not necessary associated with one only header in C
As far as I know, in the standard C++ v.17 modules were added (C++ lovers finally realized the merits of the modules  :D).
very lately yes (20 years after Modula2, natural son of Pascal) Lets pray for C++ v.23 around 2051 to fight death diamond hahahahah

sam707

  • Guest
Re: When hackers talk Truth on Pascal
« Reply #8 on: February 22, 2018, 07:08:14 pm »
Pascal uses namespaces since Turbo Pascal introduced UNITs. ;D Each unit implements its own namespace.  That allows to repeat identifiers in each unit and identify each one:

it can be understood as placeholder to namespaces, in fact it is MODULAr blocks introduced by modula2 which is a natural son of pascal

namespaces can be across files in screwed up C, Modules are one  and only one file/block (segment of memory code by past on segmented memory models)

del

  • Sr. Member
  • ****
  • Posts: 258
Re: When hackers talk Truth on Pascal
« Reply #9 on: February 22, 2018, 08:09:31 pm »
IMHO every step you take away from the purity of C takes you a step closer to the slop and bloat of Python. In that sense Pascal is a relatively pure language. I'm not a fan of "SetLength()" but it's a LOT BETTER than garbage collection IMHO.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
Re: When hackers talk Truth on Pascal
« Reply #10 on: February 22, 2018, 08:16:17 pm »
very lately yes (20 years after Modula2, natural son of Pascal) Lets pray for C++ v.23 around 2051 to fight death diamond hahahahah

20 years? That would be 1998. Modula2 (and the first unit systems of Pascal) are more 1980

Thaddy

  • Hero Member
  • *****
  • Posts: 14157
  • Probably until I exterminate Putin.
Re: When hackers talk Truth on Pascal
« Reply #11 on: February 22, 2018, 10:17:05 pm »
IMHO every step you take away from the purity of C takes you a step closer to the slop and bloat of Python. In that sense Pascal is a relatively pure language. I'm not a fan of "SetLength()" but it's a LOT BETTER than garbage collection IMHO.
C is the most impure language ever invented. Do not call C a pure language, it is a practical language with even intentional flaws if you know Kernigan and Richie. In CS terms it was always and still is flawed at the concept level, not on the implementation level. Pascal has a solid founding in CS theory....
I used to call C shorthand for assembler, and... basically... that's what it still is... It has no structure. (I think I wrote that in about 1982)
« Last Edit: February 22, 2018, 10:21:06 pm by Thaddy »
Specialize a type, not a var.

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1311
    • Lebeau Software
Re: When hackers talk Truth on Pascal
« Reply #12 on: February 23, 2018, 02:52:27 am »
to me, I use Object Pascal also because there are many decompilers for "C"'ish craps, so I feel more secure when I decide to publish apps

Decompilers parse machine instructions into human-readable code.  Object Pascal compiles to machine code, same as C does.  The generated machine code is usually even similar in both cases since both languages use similar base elements, just different synaxes for them.  I wouldn't consider Object Pascal to be any more secure than C when decompilers are concerned.  The decompiled code could easily be formatted in either language.
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

guest60499

  • Guest
Re: When hackers talk Truth on Pascal
« Reply #13 on: February 23, 2018, 03:55:19 am »
Pascal uses namespaces since Turbo Pascal introduced UNITs. ;D
True, but all units are at the top level of a hierarchy. You can put periods in their name and pretend you have nestable namespaces, but the layout of your project on disk will not mirror what you are typing.

(I'm not saying there needs to be a 1:1 correspondence like in Java. In fact, a 1:1 correspondence between unit and file name is what causes this.)

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: When hackers talk Truth on Pascal
« Reply #14 on: February 23, 2018, 02:06:50 pm »
IMHO every step you take away from the purity of C takes you a step closer to the slop and bloat of Python. In that sense Pascal is a relatively pure language. I'm not a fan of "SetLength()" but it's a LOT BETTER than garbage collection IMHO.
C is the most impure language ever invented. Do not call C a pure language, it is a practical language with even intentional flaws if you know Kernigan and Richie. In CS terms it was always and still is flawed at the concept level, not on the implementation level. Pascal has a solid founding in CS theory....
I used to call C shorthand for assembler, and... basically... that's what it still is... It has no structure. (I think I wrote that in about 1982)
I think in C (pre-C99, and not C++) as "Assembler with steroids".  You can write a C transpiler to Assembler, and it will work quite straightforward as a compiler.  So C (not C++) is my favorite programming language to do low-level stuff.
« Last Edit: February 23, 2018, 02:10:01 pm by Ñuño_Martínez »
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

 

TinyPortal © 2005-2018