Lazarus

Miscellaneous => Suggestions => Topic started by: Fred vS on November 17, 2012, 02:33:07 am

Title: I do not like ^
Post by: Fred vS on November 17, 2012, 02:33:07 am
It is a message for the High Authorities of the Pascal Academy.

I have a great respect for your language, but would it not time to take it completely ? Be brave and waive these legacies competitors.

Please, forget:
^variable
pointer^
@variable
(All are terrorizing our children)
 
and adopt:
DeRefPtr(variable)
RefPtr(pointer)
PtrtoVal(variable)
(Who are much more "Pascally").

Here example of "mixed" Official Pascal code (given by Mr Blaazen)

Code: [Select]
VAR W : Word;
    P : ^Word;

BEGIN
   W:=10;
   P:=@W;
   WriteLn(P^);
   W:=30;
   WriteLn(P^);
   P^:=80;
   WriteLn(W);
END.


and here the same code in "real" Pascal mood :

DeRefPtr(var) ----> ^var;
RefPtr(ptr) ----> ptr^ ;
PtrtoVal(var) ---->  @var ;

Code: [Select]
VAR W : Word;
    P : DeRefPtr(Word);

BEGIN
   W:=10;
   P:=PtrtoVal(W);
   WriteLn(RefPtr(P));
   W:=30;
   WriteLn(RefPtr(P));
 RefPtr(P):=80;
   WriteLn(W);
END.


Your obedient servant.

Fred vS
Title: Re: I do not like ^
Post by: Leledumbo on November 17, 2012, 04:04:38 am
Read this (http://pascal-central.com/docs/pascal1973.pdf), Niklaus Wirth never invented Pascal with caret as the pointer dereference operator, it's our current keyboard that doesn't have the required symbol. And for you, symbolphobians, please stop doing something silly regarding the symbol. You have triangles everywhere: boomerang, underwear, arrows, etc. all have nothing to do with terrorism.
Title: Re: I do not like ^
Post by: taazz on November 17, 2012, 04:29:33 am
It is not a literal terrorism as in bobs and suicide bombers it was more like "terror from beyond" "nightmare on elm street" or "chainsaw" type of thing.
Title: Re: I do not like ^
Post by: Fred vS on November 17, 2012, 05:52:48 am
@ Leleldumbo
Quote
Read this,

Very clear, maybe the clearest explanation of Pascal concept i have read.
This man is genius.
Title: Re: I do not like ^
Post by: User137 on November 17, 2012, 08:06:08 am
The symbol ^ is fine, but i think i have to agree with Delphi's philosophy with it. When i have pointer to a class or record variable, i shouldn't need to use:
recordVarPtr^.Property but just recordVarPtr.Property
Because there is no other possible outcome from it than writing it with just dot. All i can see is that it makes it clear that we are dealing with pointed value. Pointer itself is just a memory address, there's no mistaking the dot usage for meaning the value only.
Title: Re: I do not like ^
Post by: Leledumbo on November 17, 2012, 08:29:22 am
Quote
The symbol ^ is fine, but i think i have to agree with Delphi's philosophy with it. When i have pointer to a class or record variable, i shouldn't need to use:
recordVarPtr^.Property but just recordVarPtr.Property
Delphi and TP already do that, so does their corresponding compatibility mode in Free Pascal (but AFAIK only if they're accessed as parameters).
Title: Re: I do not like ^
Post by: anis2505 on November 17, 2012, 09:57:59 am
Hi,

this symbol is annoying. to me my keyboard is AZERTY and it's a French layout, to type the ^ I have to press it twice which produce ^^ and the I delete one of them. This is because this symbol not usually used in French only for some words like  être (to be in English).

regards
Title: Re: I do not like ^
Post by: eny on November 17, 2012, 10:25:51 am
this symbol is annoying. to me my keyboard is AZERTY and it's a French layout, to type the ^ I have to press it twice which produce ^^ and the I delete one of them
Press ^ space...
Title: Re: I do not like ^
Post by: anis2505 on November 17, 2012, 10:31:02 am
this symbol is annoying. to me my keyboard is AZERTY and it's a French layout, to type the ^ I have to press it twice which produce ^^ and the I delete one of them
Press ^ space...

Thanks  :)
Title: Re: I do not like ^
Post by: Fred vS on November 17, 2012, 03:34:51 pm
Quote
is annoying. to me my keyboard is AZERTY

Mine too  :-X.

By the way, i will not be against to change the symbol to point to a value  @variable  (who, for me, is property of internet) with something like  PtrtoVal(variable).

PS: I do not have absolutely nothing against symbols, it is just that, for me, using that kind of symbol is more in the  "C" mood than in Pascal.
Title: Re: I do not like ^
Post by: Blaazen on November 17, 2012, 03:46:56 pm
Quote
By the way, i will not be against to change the symbol to point to a value @ ...
You cannot replace ^ with @ .
Example:
Code: [Select]
VAR W : Word;
    P : ^Word;

BEGIN
   W:=10;
   P:=@W;
   WriteLn(P^);
   W:=30;
   WriteLn(P^);
   P^:=80;
   WriteLn(W);
END.
Example is taken from here: http://www.friends-of-fpc.org/articles/1040517/b/ (http://www.friends-of-fpc.org/articles/1040517/b/)
Title: Re: I do not like ^
Post by: Leledumbo on November 17, 2012, 03:50:40 pm
Quote
By the way, i will not be against to change the symbol to point to a value  @variable  (who, for me, is property of internet) with something like  PtrtoVal(variable).
@ is already an "address of" operator, which is read naturally: @ is read "at", so @somevar reads "at somevar" which means the address of somevar. beautifully chosen, IMO.
Title: Re: I do not like ^
Post by: Fred vS on November 17, 2012, 04:02:59 pm
@ Blaazen

DeRefPtr(var) :=  ^var;
RefPtr(ptr)  := ptr^ ;
PtrtoVal(var) := @var ;


Code: [Select]
VAR W : Word;
    P : DeRefPtr(Word);

BEGIN
   W:=10;
   P:=PtrtoVal(W);
   WriteLn( RefPtr(P));
   W:=30;
   WriteLn(RefPtr(P));
 RefPtr(P):=80;
   WriteLn(W);
END.

PS : It is for the game, im happy with the existing convention, it is only a idea in the air...
Title: Re: I do not like ^
Post by: Fred vS on November 17, 2012, 04:21:07 pm
PS 2 @ Blaazen.

It seams that the comprehension of that symbols are difficult to interpret not only by humans.
All the translator from C to Pascal or Pascal to C that i have tested have problems with negotiation with this symbols while translation...
Title: Re: I do not like ^
Post by: BigChimp on November 17, 2012, 04:29:06 pm
You can tell a person is integrated into a programming language when he starts making suggestion about how it should be changed.
You can tell a person has been using the language forever when he says to people making thos suggestions that there's a good reason why the original way was chosen.

Just joking ;)
Title: Re: I do not like ^
Post by: anis2505 on November 17, 2012, 04:56:19 pm
For someone like me coming from the Curly Brackets World If I have to choose the ^ symbol and the PtrtoVal I would choose ^ which BTW I don't like it.

Quote
You can tell a person is integrated into a programming language when he starts making suggestion about how it should be changed.
You can tell a person has been using the language forever when he says to people making thos suggestions that there's a good reason why the original way was chosen.

Just joking

It's a game of power:

Lazarus/FreePascal native users vs Delphi native users vs C and it's descendant native users.

regards.
Title: Re: I do not like ^
Post by: eny on November 17, 2012, 06:07:12 pm
Lets get rid of all these annoying symbols and tokens:

Code: Pascal  [Select][+][-]
  1.   a = b plus  c;
  2.   a = b minus c;
  3.   a = b times c;
  4.   a = b divided by c;
Title: Re: I do not like ^
Post by: BigChimp on November 17, 2012, 06:09:10 pm
Or Java style:
Code: [Select]
  a = b.plus(c);
  a = b.minus(c);
  a = b.times(c);
  a = b.dividedby(c);
Title: Re: I do not like ^
Post by: BeniBela on November 17, 2012, 06:31:52 pm
Read this (http://pascal-central.com/docs/pascal1973.pdf), Niklaus Wirth never invented Pascal with caret as the pointer dereference operator, it's our current keyboard that doesn't have the required symbol.

But now fpc supports unicode  files.

So let us change it to:

Code: [Select]
var x: ↑word;

Strangel,y I couldn't find the intended symbol for @ in that pdf

Or Java style:
Code: [Select]
  a = b.plus(c);
  a = b.minus(c);
  a = b.times(c);
  a = b.dividedby(c);

With the ability to throw a null pointer exception on every operator usage
Title: Re: I do not like ^
Post by: Fred vS on November 17, 2012, 07:11:53 pm
@ Eny

Quote
  a = b plus  c;
  a = b minus c;
  a = b times c;
  a = b divided by c;

No, no, no , it should be : in Pascal-Esperanto (why use English ?)

Quote
  a egala b pli c;
  a egala b malpli c;
  a egala b tempo c;
  a egala b dividita c;

[edit] Or, better

Quote
  a egala b pli c  punktokomo
  a egala b malpli c punktokomo
  a egala b tempo c punktokomo
  a egala b dividita c punktokomo


Title: Re: I do not like ^
Post by: anis2505 on November 17, 2012, 09:06:05 pm
Or windev style

Windev english Wlang
one variable
Code: [Select]
X is an integer
multiple variables
Code: [Select]
X, y are integers

Windev french Wlang
one variable
Code: [Select]
X est un entier

multiple variable
Code: [Select]
X, y sont des entiers

can you believe this. it's a nightmare >:D
Title: Re: I do not like ^
Post by: marcov on November 17, 2012, 11:24:12 pm
Lets get rid of all these annoying symbols and tokens:

Code: Pascal  [Select][+][-]
  1.   a = b plus  c;
  2.   a = b minus c;
  3.   a = b times c;
  4.   a = b divided by c;

and don't forget  that - has two meanings:

Code: Pascal  [Select][+][-]
  1.   a := minus a;
  2.  

The ambiguity can be finally lifted!

Code: Pascal  [Select][+][-]
  1.   a:= unaryminus a;
  2.  

Title: Re: I do not like ^
Post by: Leledumbo on November 18, 2012, 12:12:45 am
Quote
Strangel,y I couldn't find the intended symbol for @ in that pdf
There's no address of operator in original Pascal, I don't really remember when it was added, UCSD maybe?
Title: Re: I do not like ^
Post by: greatUnknown on November 18, 2012, 02:35:43 am
Looks like this thread is calling for a return to the original Cobol.
Title: Re: I do not like ^
Post by: cst_zf on December 27, 2012, 07:44:06 am
mode delphi will help a lot.
Title: Re: I do not like ^
Post by: marcov on December 27, 2012, 03:09:43 pm
Quote
Strangel,y I couldn't find the intended symbol for @ in that pdf
There's no address of operator in original Pascal, I don't really remember when it was added, UCSD maybe?

I think later in TP.

UCSD was a VM, (Java's was later modeled after it), and fairly "safe" (in the Java/.NET sense) and  not terribly strong in random pointer access.

 
Title: Re: I do not like ^
Post by: eny on December 27, 2012, 03:21:47 pm
I think later in TP.
For TP it was introduced with version 4.0
It is in my TP 4.0 manual, not in my TP 3.0 manual  :D
TinyPortal © 2005-2018