PHP RFC about variables

  110214
May 20, 2020 11:10 goootlib@gmail.com (=?UTF-8?B?0JPQu9C10LEg0JbRg9C60L7Qsg==?=)
If you look at Wikipedia, you can see that a variable in programming is a
named, or otherwise addressed, area of memory whose address can be used to
access data. The word from this definition to which I would like to draw
your attention is data.    Is it really so that in PHP and other
programming languages in which we write, variables are used only for
accessing data.   In fact, in addition to access   data, variables are also
used to access objects, arrays and some other things.   Data (strings,
integers, floating-point numbers, boolean values), objects and structures
(arrays) for a human are essentially different entities (abstractions), and
it would be reasonable to handle them as different things, ignoring the
fact that for the machine they are the same (named memory areas).   In
order to do this, I would like to propose (once again) to start to use
entities  such as, for example: object, structure, data  instead of
variables . This will help to greatly simplify the perception of the code,
because you no longer have to keep in mind the data types of most variables..
Code:

// If formerly, for example, to store objects in PHP, // we used variables
that are declared in the current syntax using the $ symbol $objectVar = new
SomeClass(); // Now for the objects we will have a special entity “object”, //
which, for example, will be declared using the * symbol *objectEntity = new
SomeClass(); // "Structure" entities will be declared using ^ symbol
^simpleArray = ['one', 'two', 'three']; ^associativeArray = ['key' => 'val',
'another_key' => 'another_val']; // And "data" entities using symbol %
%string = 'abcde'; %integer = 123; %floating = 1.23; %boolean = true;

I want to make one point right away - my concept has nothing to do with the
concept that is used in the PERL programming language, where each data type
has a separate character. I urge only to enter one symbol for all scalar
types, one symbol for objects and one for structures (arrays). The
variables themselves and the symbol that is used to denote them ($) can be
left for backward compatibility, as well as for types that are not covered
by the new entities described by me, one of such types, for example,
resource.

The last time I proposed my idea for RFC, they refused me because
allocating three new characters to implement it would be too wasteful. I do
not deny that the remaining available characters should be used wisely. But
in my opinion, in this case, the allocation of three new characters is
quite justified by substantial benefits that this innovation brings. And
due to the limited number of characters at the present time, it seems to me
unreasonable to refuse futher progress.
  110215
May 20, 2020 11:21 goootlib@gmail.com (=?UTF-8?B?0JPQu9C10LEg0JbRg9C60L7Qsg==?=)
---------- Forwarded message ---------
От: Глеб Жуков <goootlib@gmail.com>
Date: ср, 20 мая 2020 г. в 16:10
Subject: PHP RFC about variables
To: <internals@lists.php.net>


If you look at Wikipedia, you can see that a variable in programming is a
named, or otherwise addressed, area of memory whose address can be used to
access data. The word from this definition to which I would like to draw
your attention is data.    Is it really so that in PHP and other
programming languages in which we write, variables are used only for
accessing data.   In fact, in addition to access   data, variables are also
used to access objects, arrays and some other things.   Data (strings,
integers, floating-point numbers, boolean values), objects and structures
(arrays) for a human are essentially different entities (abstractions), and
it would be reasonable to handle them as different things, ignoring the
fact that for the machine they are the same (named memory areas).   In
order to do this, I would like to propose (once again) to start to use
entities  such as, for example: object, structure, data  instead of
variables . This will help to greatly simplify the perception of the code,
because you no longer have to keep in mind the data types of most
variables.  Code:

// If formerly, for example, to store objects in PHP,
// we used variables that are declared in the current syntax using the $
symbol
$objectVar = new SomeClass();

// Now for the objects we will have a special entity “object”,
// which, for example, will be declared using the * symbol *objectEntity =
new SomeClass(); // "Structure" entities will be declared using ^
symbol ^simpleArray
= ['one', 'two', 'three'];
^associativeArray = ['key' => 'val', 'another_key' => 'another_val'];

// And "data" entities using symbol %

%string = 'abcde';
%integer = 123;
%floating = 1.23;
%boolean = true;

I want to make one point right away - my concept has nothing to do with the
concept that is used in the PERL programming language, where each data type
has a separate character. I urge only to enter one symbol for all scalar
types, one symbol for objects and one for structures (arrays). The
variables themselves and the symbol that is used to denote them ($) can be
left for backward compatibility, as well as for types that are not covered
by the new entities described by me, one of such types, for example,
resource.


The last time I proposed my idea for RFC, they refused me because
allocating three new characters to implement it would be too wasteful. I do
not deny that the remaining available characters should be used wisely. But
in my opinion, in this case, the allocation of three new characters is
quite justified by substantial benefits that this innovation brings. And
due to the limited number of characters at the present time, it seems to me
unreasonable to refuse futher progress.